You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
ios message received on multiple times when the app is in foreground #194
Activity
NickIliev commentedon Feb 1, 2018
@priyangamani please provide a sample project to reproduce and investigate the issue.
priyangamani commentedon Feb 2, 2018
//LoginPage.js
var pushPlugin = require("nativescript-push-notifications");
var http = require("http");
LoginPage.prototype.pageLoaded = function (args) {
var settings = {
senderID:'98765431234',
notificationCallbackAndroid: function (message, data) {
var payload = JSON.parse(data);
switch (payload.action) {
case "NEWS":
alert(payload.id)
break;
case "MESSAGE":
alert(payload.id)
break;
default:
alert("message");
}
notificationCallbackIOS: function (data) {
alert(JSON.stringify(data));
},
badge: true, // Enable setting badge through Push Notification
sound: true, // Enable playing a sound
alert: true, // Enable creating a alert
};
pushPlugin.register(settings,
// Success callback
function (token) {
http.request({url:"http://192.168.10.189:50780/updatePush"+token,
method: "POST",
headers: { "Content-Type": "application/json"}
})
var pushSettings = settings;
if (token != '') {
if (pushPlugin.onMessageReceived) {
pushPlugin.onMessageReceived(settings.notificationCallbackAndroid);
}
}
},
function (error) {
console.log("Error");
}
);
}
}
Package.json
"nativescript-push-notifications": "^1.0.5",