How to verify that the push notification was received on the phone


#1

Hello.
I implement push notification using ionic/cloud-angular from this article http://docs.ionic.io/services/push/#sending-pushes.
In my app i need to implement next logic:

  1. My server sent to phone device push notification throught http method “https://api.ionic.io/push/notifications
  2. If phone device don’t recieve this push notification in 5 minutes (for exemple phone has not internet now), then my server send sms to this phone

My problem - when i push notification i get NotificationID. But in phone device in method msg has not propperty with NotificationID.

this.push.rx.notification()
            .subscribe((msg) => {
                alert(msg.title + ': ' + msg.text);                
            });

I want in this method tell my server, that phone device recieve this NotificationID.
So, how can i realize my logic?

PS.I also try get notification status by http https://api.ionic.io/push/notifications/:notification_id/messages, but in documentation says http://legacy.docs.ionic.io/v2.0.0-beta/docs/push-sending-push#section-message-status
MESSAGE STATUS
SENT
We have delivered the message to the appropriate device provider (APNs, GCM, etc) and did not encounter any immediate errors. This does NOT indicate a message was received on the device.


#2

Please, i need help with this question


#3

You could add in an extra custom data field that you push with the notification, then in your app apply your custom logic to that. You could also attach a function when receiving a message, which triggers a function that does whatever you want.


#4

Can you get an example?
I try this
{
“tokens”:“MyIonicKeToken”,
“profile”:“dev”,
“notification”:{“title”:“Relaxyyy”,
“message”:“test”,
“android”:{“priority”:“high”},
“additionalData”:{“OrderID”:“12”}
}

And when i debug in PushMessage in additionalData i have not OrderID field.
See picture:


#5

i get the good result with this:

“payload”:{“OrderID”:“12”}}
Thank you