How to get One Signal unique user id in Mobile?
Got the unique Id of OneSignal by using the following code which is in official site of OneSignal.
OneSignal.idsAvailable(new OneSignal.IdsAvailableHandler() {
@Override
public void idsAvailable(String userId, String registrationId) {
Log.d("debug", "User:" + userId);
if (registrationId != null)
Log.d("debug", "registrationId:" + registrationId);
}
});
Refer:
Getting code in Official Site
This Above Code is Deprecated. Please use the below code.
String UUID = OneSignal.getPermissionSubscriptionState().getSubscriptionStatus().getUserId()
The above solution for android is deprecated Use:
OSPermissionSubscriptionState status = OneSignal.getPermissionSubscriptionState();
status.getSubscriptionStatus().getUserId();