push-plugin icon indicating copy to clipboard operation
push-plugin copied to clipboard

ios message received on multiple times when the app is in foreground

Open priyangamani opened this issue 7 years ago • 2 comments

I registered the push id only once but the token will generate twice in ios device.

priyangamani avatar Jan 23 '18 11:01 priyangamani

@priyangamani please provide a sample project to reproduce and investigate the issue.

NickIliev avatar Feb 01 '18 09:02 NickIliev

//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",

priyangamani avatar Feb 02 '18 03:02 priyangamani