Open priyangamani opened 6 years ago
@priyangamani use the notification callback for iOS as shown here:
notificationCallbackIOS: (message: any) => {
console.log("Message : " + JSON.stringify(message));
}
I tried this callback but it's not firing.
On Fri, Apr 27, 2018, 6:57 PM Nick Iliev notifications@github.com wrote:
@priyangamani https://github.com/priyangamani use the notification callback for iOS as shown here https://github.com/NativeScript/push-plugin#using-the-plugin-in-ios:
notificationCallbackIOS: (message: any) => { console.log("Message : " + JSON.stringify(message)); }
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NativeScript/push-plugin/issues/216#issuecomment-384937488, or mute the thread https://github.com/notifications/unsubscribe-auth/AFwiNR0fLYtfya7fG_8HBy4mFdNra4Lgks5tsvmygaJpZM4Tp5US .
@priyangamani are you receiving the notifications? DO you have your APNS certificate set?
@NickIliev yes able to receive the notification .I have the APN cert. How to handles some keys in the data object like message, title, and uses them to construct a notification entry in the tray on ios? In android i able to retrive the payload actions but ios cannot. application.on(application.resumeEvent, function(args) { if (args.android) { var act = args.android; var intent = act.getIntent(); var extras = intent.getExtras(); if (extras) { // for (var key in extras) { // console.log(key + ' -> ' + extras[key]); // } var msg = extras.get('someKey'); } } if(app.ios){ //Here what i need to do? } });
I got the push notifications are working, but I don't know how to extract the response. So my question is how do I access the data inside of alert for the 'body' and 'title'?
I am interested in the solution for iOS, too.
Here's our current setup in Android: A device receives a push notification while the app is closed. The push notification contains data that tells the app which page should be opened. After the push notification is tapped, the app is opened, and the resume event of the app is called. The push notification's data is read (using the code that priyangamani listed above) and the correct page is displayed. This is all working as intended.
In iOS, a device receives a push notification while the app is closed. The push notification contains the same data as an Android one (we're using Firebase to send the push notifications) but I don't know how to access that data. If the push notification is tapped, the app is opened and the homepage is displayed, but we'd prefer a different page to be displayed. How can I access the push notification's data so that we can control which page is displayed?
Thanks in advance!
@JDillon08 could you share the code snippet how you implemented Android setup so you can open specific page. Thanks
@bachras Here's the code that we use to navigate to a specific page after resuming the app via tapping a push notification on an Android device:
// App resume event
application.on(application.resumeEvent, function(args) {
if (args.android) {
var act = args.android;
var intent = act.getIntent();
var extras = intent.getExtras();
if (extras) {
var data = extras.get('DATA_NAME');
// Navigate to a specific page based off of data's value
}
}
});
How to retrieve and handle the payload data from the app in background & foreground (APN Message)in ios.In Payload key reference i receive multiple items.How to i check and get the data.Please give some reference. Please give some reference. { "aps" : { "alert" : { "body" : "great match!", "title" : "Portugal vs. Denmark", }, "badge" : 1, }, "customKey" : "customValue" }