document.addEventListener("plusready", function() {
// 监听点击消息事件
plus.push.addEventListener("click", function(msg) {
}, false);
// 监听在线消息事件
plus.push.addEventListener("receive", function(msg) {
createLocalPushMsg(msg);
}, false);
}, false);
function showAlert(tiltle) {
alert(tiltle);
}
function bindAlias(alias) {
var PushManager = plus.android.importClass("com.igexin.sdk.PushManager");
var mainActivity = plus.android.runtimeMainActivity();
var i = PushManager.getInstance().bindAlias(mainActivity, alias);
}
function unbindAlias(alias) {
var PushManager = plus.android.importClass("com.igexin.sdk.PushManager");
var mainActivity = plus.android.runtimeMainActivity();
var i = PushManager.getInstance().unBindAlias(mainActivity, alias);
}
function getClientid() {
var PushManager = plus.android.importClass("com.igexin.sdk.PushManager");
var mainActivity = plus.android.runtimeMainActivity();
return PushManager.getInstance().getClientid(mainActivity);
}
//创建本地通知
function createLocalPushMsg(msg){
var options = {cover:false};
var str = msg.title;
plus.push.createMessage( str, "LocalMSG", options );
}
//拉起服务的代码是这样的 :这个代码经测试,有或没有都可以收到通知消息
function startService() {
var main = plus.android.runtimeMainActivity();
var Intent = plus.android.importClass('android.content.Intent');
var intent = new Intent();
var serviceName = 'com.igexin.sdk.PushService';//把这里换成其他Service的名字,也可以实现拉取自定义的Service
intent.setClassName(main, serviceName);
main.startService(intent);
}
3 个回复
1***@qq.com - 90后IT男
你好,你解决了吗,遇到了同样的问题
1***@qq.com - 90后IT男
已解决:
//此时是消息
var strs = "message:"+content;
if (msg.payload != strs) {
plus.push.createMessage("您有一条新消息", strs, options);
}
菜鸡一个
楼主IOS怎么绑定标签?