2017-09-20 186 views

回答

0

尝试接收时应用程序是在前台,但同时接收应用程序在后台我按照FCM教程方式和实施this plugin

当设备准备好我会触发此代码:

pushNotification.register(
function (result) { 
    //Do some stuff 
}, function (error) { 
    //Do some stuff on error 
}, { 
    "badge":"true", 
    "sound":"true", 
    "alert":"true", 
    "ecb": "onNotificationAPN" 
}); 

而且也低于功能实现:

function onNotificationAPN(event) { 
    if (event) { 
    if (event.alert) { 
     alert(Recieved alert: + event.alert); 
    } 
    if (event.sound) { 
     var snd = new Media(event.sound); 
     snd.play(); 
    } 
    if (event.badge) { 
     pushNotification.setApplicationIconBadgeNumber(function() { 
     //SetApplicationIconBadgeNumber success. 
     }, function() { 
     //SetApplicationIconBadgeNumber error. 
     }, 
     event.badge); 
    } 
    } 
} 
+0

我想离子的代码 –

+0

ohh让我检查 –

+0

请检查我的更新答案,我不擅长离子,但试试这个,让我知道 –

相关问题