https://github.com/jpush/jpush-phonegap-plugin
Install
通過(guò) Cordova Plugins 安裝,要求 Cordova CLI 5.0+:
cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_jpush_appkey
或直接通過(guò) 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初始化并注冊(cè)
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.取消注冊(cè)
window.plugins.jPushPlugin.deleteAlias({"sequence":1}, (okData)=> {
this.utils.showToast({msg: 'jpush ok'});
},
(failData)=> {
this.utils.showToast({msg: 'jpush fail '+failData});
});