Skip to content

Commit

Permalink
更换极光推送appKey
Browse files Browse the repository at this point in the history
  • Loading branch information
tower1229 committed Jan 3, 2018
1 parent 552bb36 commit b8981e4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
<preference name="urlScheme" value="hybridstart" />
<preference name="querySchemes" value="hybridstart" />
<preference name="customRefreshHeader" value="UIPullRefreshFlash"/>
<preference name="backgroundMode" value="location"/>
<preference name="backgroundMode" value="location | remote-notification"/>
<access origin="*"/>
<feature name="bMap">
<param name="android_api_key" value="yTHKTQDYu0BMkLjlZG70LQkbARMmHT4q"/>
<param name="ios_api_key" value="3m35LRAiDh3HpkRXqRLI0cxroP2HY5eb"/>
</feature>
<feature name="ajpush">
<param name="app_key" value="b6d16a3ea25c6b8c98896a44"/>
<param name="app_key" value="a0824a0d17d925f42664fc3c"/>
<param name="channel" value="your channel"/>
</feature>
</widget>
16 changes: 4 additions & 12 deletions sdk/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ define(function(require, exports, module) {
return app.toast('初始化用户信息失败');
}
userData.photo = _source($.trim(userData.photo));
// userData.nowScore = $.trim(userData.nowScore) || 0;
userData.realName = $.trim(userData.realName);
app.storage.val('user', userData);
//app初始化
Expand All @@ -91,9 +90,11 @@ define(function(require, exports, module) {
ajpush.bindAliasAndTags({
alias: "user_" + userData.id,
tags: userData.tag.split(',')
}, function(ret) {
if (ret.statusCode) {
}, function(ret, err) {
if (ret) {
console.log("user_" + userData.id + "成功注册推送");
}else{
console.log(JSON.stringify(err));
}
});
}
Expand Down Expand Up @@ -127,15 +128,6 @@ define(function(require, exports, module) {
};
//获取用户信息
var _getUser = function(hold) {
//测试数据
return {
id: "0001",
headImg: seajs.root + '/res/img/avat.jpg',
nickName: '珊珊',
realName: '伐木累',
nowScore: 99,
mobile: '15067589521'
};
var _user = app.storage.val('user');
if (!$.isPlainObject(_user) && !hold) {
app.ready(function() {
Expand Down
12 changes: 7 additions & 5 deletions view/root/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ define(function(require) {
pushable = app.storage.val('pushable') === '1';
if (ajpush) {
var catchPush = function(json) {
alert(JSON.stringify(json));
var id = json.id;
var title = json.title;
var content = json.content;
var extras = json.extras ? json.extras : {};
alert(`推送内容:${content}`);
};
var pushFunc = function() {
//前台接收通知
//app内拦截自定义消息
ajpush.setListener(function(ret) {
catchPush(ret);
});
//点击消息
if (window.platform === 'android') {
//点击标题栏消息
var platform = api.systemType;
if (platform === 'android') {
api.addEventListener({
name: 'appintent'
}, function(ret, err) {
Expand All @@ -59,6 +59,8 @@ define(function(require) {
ajpush.init(function(ret) {
if (ret && ret.status) {
pushFunc();
}else{
console.log(JSON.stringify(ret));
}
});
}
Expand Down

0 comments on commit b8981e4

Please sign in to comment.