Joe Clarke
Posts: 0
Joined: Fri Sep 06, 2013 4:05 pm

Redirect based on push notification

Thanks.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Redirect based on push notification

Sorry for misunderstanding Joe
[quote:]That doesn't seem to work because data.aps.alert only has something in it if you received the push notification while inside of the application.[/quote] we had this bug and it has been fixed for Android some time ago.. We need to test it again and unfortunately it might take time. Someone will get back as soon as possible with update.

Perhaps there is the same issue with iOS apps.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Redirect based on push notification

Hello! It works on Android device, but there is a bug on iOS devices unfortunately. We'll fix it as soon as possible.

Kevin Preston
Posts: 0
Joined: Wed Oct 09, 2013 12:18 pm

Redirect based on push notification

I would like to take the user directly to a specific page on receipt of a push message. Your suggestion above :-
var pageName = data.aps.alert;
Appery.navigateTo(pageName);

works but it means that the push message, as shown in the initial Android notification, shows the page name which is not very user friendly. I would like the message to show in the notification as usual but still force the user to the specific page. Is this possible?
Also has anyone come up with a way of opening the app directly a push arrives without having to click the notification first?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Redirect based on push notification

Hello!
1) "opening the app directly a push arrives without having to click the notification first" - I don't think it's possible
2) use if or switch to define where to redirect userprevar message = data.aps.alert, pageName = '';
switch(message){
case "My friendly message 1": pageName = "pageName1"; break;
case "My super friendly message 2": pageName = "pageName2"; break;
case "Just friendly message 3": pageName = "pageName3"; break;
}
if (pageName) {
Appery.navigateTo(pageName);
}/pre

Kevin Preston
Posts: 0
Joined: Wed Oct 09, 2013 12:18 pm

Redirect based on push notification

Maryna,
Thanks, you've given me some ideas on how to solve my problem.

A.W.H.
Posts: 0
Joined: Sat Jun 20, 2015 7:02 am

Redirect based on push notification

How to automatically push in background? I'm on the standard plan which refreshes code every 15 minutes.

A.W.H.
Posts: 0
Joined: Sat Jun 20, 2015 7:02 am

Redirect based on push notification

This doesn't answer how the reciever of the push notification will call these lines which perform a switch statement according to message type and deeplink location.

Thoughts? Thanks in advance if you would provide sample code/examples.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Redirect based on push notification

You can schedule your push notifications: https://devcenter.appery.io/documenta... or execute a Server side script for sending push messages.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Redirect based on push notification

You can use only JavaScript modification as shown in example above.

Return to “Issues”