Bluemix Mobile Push Notification Service, how to register by consumerId

164 Views Asked by At

When send push notification messages, consumerIds can be specified as target. But when register the device, I don't see where to supply the consumerId in the SDK doc.

Register iOS Devices

Register Android Devices

Can you let me know how to register with the consumerId?

Thanks,

Jen

2

There are 2 best solutions below

0
On BEST ANSWER

Currently there is no way to register a consumerId / userId through the Android and iOS SDKs. This is a feature that existed prior but was removed due to security issues when dealing with the public facing REST APIs. It is my understanding that work is being done to reintroduce the functionality but I know nothing more than that.

That said it is possible to recreate the functionality through the REST API (https://mobile.ng.bluemix.net/imfpushrestapidocs/#!/devices/put_apps_applicationId_devices_deviceId)

In short what you would need to do it register the device normally through iOS or Android, then execute the REST GET devices/{deviceId} using the deviceId obtained at the time of registration. From there you could copy off the data, insert your desired consumerId and then execute PUT devices/{deviceId} using that data to update the device registration with the new consumerId.

The answer I posted here goes over that in a little more detail How to register a userId to Bluemix Push Notifications services?

Again unfortunately it's pretty convuluted to execute at this point while we wait on the native SDKs to reacquire the functionality. In some cases it may be wiser to just create your own mapping of deviceIds to consumerIds and use deviceIds as your push parameter.

1
On

Have you check this documentation of the rest API for IBM Push Notification? https://mobile.ng.bluemix.net/mbaas-api/?cm_mc_uid=70457747682413998998889&cm_mc_sid_50200000=1456154344#!/push/sendMessage_post_21

There's optional parameters for consummerIds and deviceIds.

There's also this more complex API documentation of IBMPushService: https://mobile.ng.bluemix.net/mbaas-api/docs/JavaScript/IBMPushService.html?cm_mc_uid=70457747682413998998889&cm_mc_sid_50200000=1456154344