I am trying to use Adapter for Push Notification. I followed all steps define in this IBM Worklight Developer site for Push Notification and make a project and its working. Now further i want to send notifications to a specific device. For this worklight give a method getDeviceSubscriptions() which return JSON array containing number of object for each subscribed device.
deviceSubscriptions = userSubscription.getDeviceSubscriptions() ;
the JSON include:
[{
"platform":"Google",
"eventSourceId":"PushAdapter.PushEventSource",
"alias":"myPush",
"token":" ",
"userAgent":" ",
"device":" ",
"applicationId":" ",
"options":{}
}]
Now i want to use the data in JSON for getting device and token. Now for this i use JSON.stringify(deviceSubscriptions) this method convert deviceSubscriptions into string. But i want that i can direct access to token and device in JSON array for this i used JSON.parse(deviceSubscriptions ) but this giving error:
"Ecma Error: TypeError: Cannot find default value for object. (C%3A%5Cworkspace%5CFINAL%5Cadapters%5CPush/Push-impl.js#43)"
Line 43 is:
JSON.parse(deviceSubscriptions)
Any help would be appreciated