1
votes

I am using Mobilefirst 8.0 push notification part in cordova application downloaded sample application which is given by IBM. Its working fine. When I click on register device button device id I can see in mobilefirst console.

1) How I can get that same device ID in client side application?

2) User ID field also I can see in mobilefirst console device register information. How Can I add particular User ID while registering device?

1

1 Answers

1
votes

1) How I can get that same device ID in client side application? You can call the following REST endpoint in order to retrieve from the server various data about the application, including the deviceId: http://www.ibm.com/support/knowledgecenter/en/SSHS8R_8.0.0/com.ibm.worklight.apiref.doc/rest_runtime/r_restapi_push_device_registrations_get.html

2) User ID field also I can see in mobilefirst console device register information. How Can I add particular User ID while registering device?

The sample uses the MobileFirst security framework, and that's where the userId is coming from. Please refer to the security documentation, tutorials and samples:

The same userId is also used by the Push service by default (Push retrieves the user id from the request being made and if the user is already logged in, the userid part of the request). If there is no challenge handler in place the default user id would be anonymous.