https://github.com/jpush/jpush-phonegap-plugin
-
Install
通过 Cordova Plugins 安装,要求 Cordova CLI 5.0+:
cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_jpush_appkey
或直接通过 url 安装:
cordova plugin add https://github.com/jpush/jpush-phonegap-plugin.git --variable APP_KEY=your_jpush_appkey
或下载到本地安装:
cordova plugin add Your_Plugin_Path --variable APP_KEY=your_jpush_appkey -
初始化并注册
declare let cordova:any;
initJpush() {
window.plugins.jPushPlugin.init();
window.plugins.jPushPlugin.setAlias({"sequence":1,"alias":this.identifierNumber}, (okData)=> {
this.utils.showToast({msg: 'jpush ok'});
},
(failData)=> {
this.utils.showToast({msg: 'jpush fail '+failData});
});
}
3.取消注册
window.plugins.jPushPlugin.deleteAlias({"sequence":1}, (okData)=> {
this.utils.showToast({msg: 'jpush ok'});
},
(failData)=> {
this.utils.showToast({msg: 'jpush fail '+failData});
});
网友评论