notification Push reçoit pas quand App est au premier plan, mais reçoivent en application en arrière-plan, j'ai suivi tutoriel FCM de https://medium.com/@ankushaggarwal/gcm-setup-for-android-push-notifications-656cfdd8adbdFCM notification Push n'a pas reçu lorsque l'application est au premier plan, mais recevoir quand l'application en arrière-plan
Répondre
Essayez dans ce manière et la mise en œuvre this plugin.
Et lorsque l'appareil prêt, j'ai tiré ce code:
pushNotification.register(
function (result) {
//Do some stuff
}, function (error) {
//Do some stuff on error
}, {
"badge":"true",
"sound":"true",
"alert":"true",
"ecb": "onNotificationAPN"
});
Et aussi mis en œuvre ci-dessous fonction:
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);
}
}
}
je veux du code en ionique –
ohh laissez-moi vérifier –
s'il vous plaît vérifier ma réponse mise à jour, je ne suis pas si bon à ionique, mais essayez ceci et laissez-moi savoir –
Quel appareil que vous essayez? –
Android 6.0 périphérique –