简体   繁体   中英

sendMessage IBM Bluemix PushNotification Rest API is unregistering the device

I am using IBM Bluemix Rest APIs for Push Notifcation with Spring Boot 1.5.6.RELEASE and Java 1.8. I am using RestTemplate for invoking the below APIs from Java Code. I am sending push notifications to ios devices registered to APNS (Apple Push Notification service).

I am binding the push notification service to my java app on BlueMix and getting the url, clientSecret, and appSecret from VCAP_SERVICES.

I am noticing a weird behavior and was wondering if anyone else has also experienced the same.

Please refer to the below steps:

  1. I am registering a device using "registerDevice" POST API. The endpoint for which is " http://imfpush.xxxxxxxx.xxxx.bluemix.net/imfpush/v1/apps/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices ".
  2. I verify that the device is registered successfully using "getDevices" GET API. The endpoint for which is " http://imfpush.xxxxxxxx.xxxx.bluemix.net/imfpush/v1/apps/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices ".
  3. I then send a push noification using "sendMessage" POST API. The endpoint for which is " http://imfpush.xxxxxxxx.xxxx.bluemix.net/imfpush/v1/apps/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/messages ".

The weird behavior I am noticing is after invoking the sendMessage POST API, the device which I registered in step 1 is no longer registered. After step3 above if I go back to step 2 and invoke the "getDevices" API again, the device is no longer registered. It returns below response:

{ "pageInfo": { "totalCount": 0, "count": 0 }, "devices": [] }

Is this a bug in "sendMessage" POST API?

Please help

Thanks in advance

The de-registration of the device is due to an invalid or inactive token for that registered device. Bluemix is deleting the registration because APNs/GCM is responding that the device's token is invalid when a push is attempted against it. Can you please make sure to configure valid credentials for APNS/GCM.. Follow the steps from the doc to Obtain your notification provider credentials

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM