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.
How to receive and Handle Messages from APN in ios nativescript. #216
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"
}
@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'?
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?
@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
}
}
});
Activity
NickIliev commentedon Apr 27, 2018
@priyangamani use the notification callback for iOS as shown here:
priyangamani commentedon Apr 27, 2018
NickIliev commentedon Apr 27, 2018
@priyangamani are you receiving the notifications? DO you have your APNS certificate set?
priyangamani commentedon Apr 27, 2018
@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?
}
});
priyangamani commentedon May 2, 2018
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'?
JDillon08 commentedon May 14, 2018
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!
bachras commentedon Jul 21, 2018
@JDillon08 could you share the code snippet how you implemented Android setup so you can open specific page. Thanks
JDillon08 commentedon Jul 25, 2018
@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: