Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 581
Parama Sudha Avatar asked Apr 02 '16 06:04

Parama Sudha


People also ask

How do I get my player ID one signal?

a user opens your mobile app with the OneSignal SDK initialized for the first time. a user subscribes to your website with the OneSignal SDK initialized. an email address is provided to OneSignal. a phone number is provided OneSignal.


1 Answers

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() 
like image 163
Parama Sudha Avatar answered Oct 05 '22 23:10

Parama Sudha