I am following the guide here for Ionic 2 Push
http://docs.ionic.io/services/push/
http://docs.ionic.io/services/profiles/#ios-setup
The app ran fine and gave me the token:
def3de8eddbc9c280a4b358864855306bbb8161031c9a07346ed419e54d3f703
I tried to test using the Ionic.io service GUI but the device didn’t get the notification although the status said Sent as below:
I only have one device and one user. So it must go to mine.
Then I tried to use curl
method:
curl -X POST -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzNWNkYjdmMi0xMzNmLTQzODItOGI5ZS0yYjMwYTJkYmE5NmEifQ.ixyfOPL4lx3PfunD3TD-wCrsjpEBm4rsCg1x3EHwHsA" -H "Content-Type: application/json" -d '{ "tokens": ["def3de8eddbc9c280a4b358864855306bbb8161031c9a07346ed419e54d3f703"], "profile": "testnotif1", "notification": { "message": "Hello World!" } }' "https://api.ionic.io/push/notifications"
I got the Authorization token from the Ionic.io > Settings > API Tokens
page. This is the result:
{
"data":{
"config":{
"tokens":[
"def3de8eddbc9c280a4b358864855306bbb8161031c9a07346ed419e54d3f703"
],
"notification":{
"message":"Hello World!"
},
"profile":"testnotif1"
},
"uuid":"87ad289d-5208-4b8c-b7a4-43c2b533a39e",
"app_id":"e396c56b",
"created":"2016-09-09T09:02:12.484421+00:00",
"state":"enqueued",
"status":"open"
},
"meta":{
"request_id":"ce9c64e0-23e7-4ed9-9305-d997f1886ea6",
"version":"2.0.0-beta.0",
"status":201
}
}
Then I tried to get the status with this:
curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzNWNkYjdmMi0xMzNmLTQzODItOGI5ZS0yYjMwYTJkYmE5NmEifQ.ixyfOPL4lx3PfunD3TD-wCrsjpEBm4rsCg1x3EHwHsA" -H "Content-Type: application/json" "https://api.ionic.io/push/notifications/87ad289d-5208-4b8c-b7a4-43c2b533a39e"
The result is:
{
"data":{
"uuid":"87ad289d-5208-4b8c-b7a4-43c2b533a39e",
"state":"enqueued",
"app_id":"e396c56b",
"config":{
"notification":{
"message":"Hello World!"
},
"profile":"testnotif1",
"tokens":[
"def3de8eddbc9c280a4b358864855306bbb8161031c9a07346ed419e54d3f703"
]
},
"created":"2016-09-09T09:02:12.484421+00:00",
"status":"locked"
},
"meta":{
"version":"2.0.0-beta.0",
"request_id":"4fef0e2d-1f3f-4374-b191-805e3b509ebb",
"status":200
}
}
At this point, I don’t know how to troubleshoot “stuck” push notification. Where did it go and what caused my device not receiving?
Any idea?