小编SUJ*_*M U的帖子

当应用处于空闲状态或处于后台时,如何获取Cordova Android推送通知?

即使应用处于闲置状态或处于后台,我们如何在phonegap android应用中获取GCM 推送通知

“ katzer / cordova-plugin-background-mode”似乎不起作用...

当应用程序运行在前台时,我成功获得了推送通知

科尔多瓦版本:4.3.0 android 4.4 phonegap 4.2.0

我会复制下面我通知功能......上deviceready

函数onDeviceReady(){

        try 
            {
                      pushNotification = window.plugins.pushNotification;
              jQuery("#app-status-ul").append('<li>registering ' + device.platform + '</li>');
                      if (device.platform == 'android' || device.platform == 'Android' ||
                                device.platform == 'amazon-fireos' ) {
            pushNotification.register(successHandler, errorHandler, {"senderID":"my-project-id","ecb":"onNotification"});   
              } else {
                          pushNotification.register(tokenHandler, errorHandler, {"badge":"true","sound":"true","alert":"true","ecb":"onNotificationAPN"});  // required!
                      }
            }
        catch(err) 
            { 
              txt="There was an error on this page.\n\n"; 
              txt+="Error description: " + err.message + "\n\n"; 
              alert(txt); 
            } 
        }
Run Code Online (Sandbox Code Playgroud)

和 …

android cordova

5
推荐指数
1
解决办法
5262
查看次数

标签 统计

android ×1

cordova ×1