-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get the current playerid/userid #4
Comments
Good idea. OneSignal.idsAvailable((idsAvailable) => {
console.log(idsAvailable.playerId);
console.log(idsAvailable.pushToken);
}); on the latest package. |
That's an awesome fast response! Thank you! |
Let me know if it works or you have any issues. |
@avishayil I looks like it's working on iOS. Thank you! |
Your'e welcome! |
how does that work for iOS/Swift? |
@alejandrorbradford and anyone else getting here after a google search here it is for Swift:
|
for people coming here in 2017:
|
I cannot get the playerId. How can I get the player id? I have installed the version 3.0.7. Thanks in advance! |
Apparently it has now changed. According to the docs you have to add an event listener:
|
Yeah but that new onIds function never gets fired. |
What about Web push? Is it possible to "send notifications to an specific user"? |
So, using the latest version (3.2.2) componentWillMount() {
} async updatePushId(device) { This worked for me. |
@bhgames it worked. thanks. |
Because you needed to know it. That's why. :P React Native development is the worst development. |
https://documentation.onesignal.com/docs/ios-native-sdk#section--getpermissionsubscriptionstate- let userId = OneSignal.getPermissionSubscriptionState().subscriptionStatus.userId
print("your userID:",userId!) |
The goal was to recieve PlayerID from Onesignal on application launch. let userID;
componentWillMount() {
OneSignal.init(ONESIGNAL_APP_ID, {
kOSSettingsKeyAutoPrompt: true,
});
OneSignal.getPermissionSubscriptionState( (status) => {
userID = status.userId;
alert(userID);
});
} |
Has anyone figured this out? How can I get the Player ID of a specific device? I need this to be able to send push notifications to my users. Groups and filters are worthless in my application. The only thing I need is the Player ID and I can't find anything about how to get this in any of the documentation. Can someone please help? My app is built in Ionic V3. |
I have the same problem, documentatoin is not clear
this is my code and it was told to me in other thread that i should use OneSignal.getPermissionSubscriptionState(callback) but where ? and how ? and how will I pass playerID? please someone help |
@davekedar I was able to get this to work by calling it in my ionViewDidLoad()
This is working for me; give it a shot. |
Thanks @kenef |
Just invoking E.g.:
|
To help those still having issues getting the
The |
How do I get this to work in Cordova? |
@luizmagao what is your environment? |
hello i have quickblox dialogid how i fetch quickblox userid by using this dialogid |
So, How can you extract the ID ? Could you explain it more? |
Get the all playerid/userid using jquery and other .Please let me know it's possible or not |
This worked for me in functional component:
|
thank you.. you are my hero |
can you send me the code you use here |
i cannot get playerid in latest version v9 of onesignal in react native |
OneSignal.getDeviceState().then((idsAvailable) => {console.log('idsAvailable', idsAvailable?.userId)}); |
OneSignal.getDeviceState().then(idsAvailable => { Throws an "undefined is not a function" "react-native-onesignal": "^5.0.1", |
Hi @yepes,
Please see this guide for all the methods and properties available in version 5.x.x of the react-native-onesignal library. |
Is it currently possible to get the current OneSignal userid/playerid like this on iOS? https://documentation.onesignal.com/docs/ios-sdk-api#section-idsavailable.
I need it to send a specific notification to a specific user.
The text was updated successfully, but these errors were encountered: