I want to get the currently subscribed device ID ? how i can get it on the client side or on the server side?
I know the subscription table, but i donn't want to get from it.
Secondly, if one user has already subscribed two devices and now he/she is subscribing third device, i want to capture the third (current) device ID.
Later, I have to save that third device Id in my another table.
If there is no way to identify the currently subscribed device , then if i go to subscription table, then how i get know that "this device ID is the newly registered device ID ? "
Hope it would be clear.
Thanks
When registering event source in adapter you can specify onUserSubscribe callback. This callback will be invoked once user subscribes to push notifications. Once invoked this callback will receive user subscription object as a parameter. This object contains both userId and deviceId.
WL.Server.getUserNotificationSubscription("event-source","userId") will return user subscription object with an array of device subscriptions. Each device subscription object will have deviceId.
On a client side deviceId is a userId of device authentication realm. E.g. in case you use no provisioning you can get deviceId by using WL.Client.getUserInfo("wl_deviceNoProvisioningRealm", "userId");
Server side doesn't know your "current" device. You can use onUserSubscribe callback to mark specific device as latest.
user subscription object can have custom properties, you can use them to maintain subscription state.