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.
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.
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()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With