Phone Gap推送插件支持的版本?

时间:2015-05-11 13:31:11

标签: cordova push-notification phonegap-plugins phonegap-build phonegap-pushplugin

您正在开展cordova项目,我为我的应用程序实施了手机间隙推送插件。

设备注册正在某些版本的android上运行,但在其他版本中没有。

这是一个问题来自推送插件还是需要更改代码?

设备ID没有出现在某些版本上,我认为是较低版本。

请注意:我使用真实设备测试,而不是使用模拟器。

1.注册

try { 
        pushNotification = window.plugins.pushNotification;
        if (device.platform == 'android' || device.platform == 'Android' || device.platform == 'amazon-fireos' ) {
          pushNotification.register(successHandler, errorHandler, {"senderID":"602307454049","ecb":"onNotification"});
        } 
        else {
          pushNotification.register(tokenHandler, errorHandler, {"badge":"true","sound":"true","alert":"true","ecb":"onNotificationAPN"});
        }
      }
      catch(err) { 
        txt="There was an error on this page.\n\n"; 
        txt+="Error description: " + err.message + "\n\n"; 
        // alert(txt);
        console.log(txt);
      } 

2.on ecb

function onNotification(e) {
  console.log("EVENT -> RECEIVED:"+ e.event);
  switch( e.event )
  {
    case 'registered':
    if ( e.regid.length > 0 )
    {
      console.log("regID = " + e.regid);
      alert("Device Registred gcm_regid="+e.regid);


    }
    break;

0 个答案:

没有答案
相关问题