How to get One Signal unique user id in Mobile?

I am developing a restaurant app. I am using One Signal in my app to send notifications. Here while I place the order I need to send the unique Id of the one signal for a specific user for getting notification of "Your Order is placed successfully... It is in Progress.Please wait". For that I need the user's One Signal user id. How can I get it? I am newbie to One Signal. Please help me.


  • Got the unique Id of OneSignal by using the following code which is in official site of OneSignal.

    OneSignal.idsAvailable(new OneSignal.IdsAvailableHandler() {
            public void idsAvailable(String userId, String registrationId) {
                Log.d("debug", "User:" + userId);
                if (registrationId != null)
                    Log.d("debug", "registrationId:" + registrationId);


    Getting code in Official Site

    This Above Code is Deprecated. Please use the below code.

    String UUID = OneSignal.getPermissionSubscriptionState().getSubscriptionStatus().getUserId()