Ionic 2 push notification doesn't send but has state enqueued and status locked

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?

Same exact experience for me, making great headway on Ionic2 post notifications, this is latest wall. Any thoughts from the community?

{
  "meta": {
    "status": 200,
    "request_id": "b3d29963-e5ec-4461-ab16-78eaefa9158c",
    "version": "2.0.0-beta.0"
  },
  "data": {
    "uuid": "1526286e-c421-41a1-878a-51f2b2dc74a2",
    "state": "enqueued",
    "created": "2016-09-12T21:21:07.763862+00:00",
    "config": {
      "tokens": [
        "eoAkv_sbhFQ:APA91bEQ3wWF8PCTs_Bcn-2jcJf4bs7Br7N3xofGcWCWAOVHexkx8zqGypBUtcrsIhGahk2y_fkJnfZsoupSkS8eIg1JdRyoRslBGJ7JOsMLVgIsrfverZNVoji61KRo1s0Js8Bmm8ug"
      ],
      "profile": "ionicsecurityprofile_prod",
      "notification": {
        "message": "message 01 test"
      }
    },
    "status": "locked",
    "app_id": "6e4680fa"
  }
}

Hi there,

I am also on the same problem. However, when i sent a request with send_to_all set to true, my phone receives the notification (app open).

Could be something wrong with the tokens.

EDIT: Works when I include send_to_all and set it to false! Example below:

let body = JSON.stringify({
            "send_to_all": false,
            "tokens": targets,
            "profile": "asdf",
            "notification": {
                "title": title,
                "message": message
            }
});

I found out in my case, the push certificate p12 file was incorrectly setup as I didn’t use the same request file.

For me, the problem was that I was missing the title property under notification. Looks like that might be the problem for you.

Hi,

I am facing the same issue. I tried the suggestions in the thread, but nothing worked so far.

any other resolution?

Hello everyone!

I have a similar issue. Cannot receive notifications on iOS device. Android works fine.

on iOS device, IonicRegister works fine, gives me the device token. > When I use the same device token to send push messages via firebase notification console, I received the message. But not when using Ionic Push API.

The response is below: 
{"meta":
           {
            "request_id":"5eb5c808-917b-4002-c050-4cd9a9a5ebd8",
           "status":201,
           "version":"2.0.0-beta.0"
          },
"data":
         {
         "config":
              {
              "profile":"app_push_`Preformatted text`profile",
              "tokens":["fU3XOs18E7M:APA91bEBp9BpX6ONFL--P2xl3qxTIEnzi92Q7Tjt4BriIwAi-8PdqNav6aLFTqz1BP6WNTN8hgFSloQIjppxj6CQ02xbOTFubBD8w5-qqH--IjihunZ2rgmnabCFBxv9lhpy_kH3M5kN"],
              "send_to_all":false,
               "notification":
                  {
                  "title":"You have a new Message",
                 "message":"test message",
                  "android":
                       {
                       "title":"You have a new Message",
                       "message":"test message"
                        },
                      "message":"test message",
                      "ios":
                       {
                      "title":"You have a new Message",
                       "message":"test message"
                       }
                 }
            },
           "status":"open",
           "created":"2017-02-26T11:24:48.959005+00:00",
           "uuid":"40f63391-8e57-4ca4-a020-0f6d3cecff65",
           "state":"enqueued",
           "app_id":"e66180e6"
        }
  }

I have also uploaded the APNs certificate to the security profile on ionic push admin page.
And have also uploaded the certs to firebase cloud messaging.

I’ve been stuck on this for a while now. Any help or suggestion will be greatful.