[OneSignal Notification Plugin] How can i get PlayerId from OneSignal
Forge component by Alexandre Costa


after register device, i would like to save playerid but there is no output in plugin.

how can i get this output?


fkaratay wrote:


after register device, i would like to save playerid but there is no output in plugin.

how can i get this output?


Hi please take a look at the demo.


I tried looking into that demo but the player ID always returns null.

I am using the below Javascript just like the demo. 

window.plugins.OneSignal.getIds(function(ids) {
    $parameters.playerId =  ids.userId;

Also how if the "DeviceID" mapped to the registered user? I cant find the corrilation between device ID and playeID.

Hi, you can send tags to OneSignal...

My approach is to send userid in "userid" tag.

Then I can send notification to that specific userid using tag as filter.

I think the problem is that I dont have access to the OneSignal APIs. It seems more likely that the API calls are failing because they cannot be found more than anything else. 

When I add the OneSignal plugin, does it contain the Javascript code required to run these APIs? I dont see it. All I see is the Extensible consifguration which points to a GitHub repo. 

After I add this GitHub repo as a plugin and rebuild the application I still seem unable to use the APIs. Can anyone successfully use these APIs?

The OneSignal API only contained Rest Api call which cannot be made public.

I think it only served as an example on how to send a push notification using rest api.

You can download OneSignal Plugin Demo to see how to send push notifications. 

If you're stack is .Net then maybe use the brand new official OneSignal plugin. (I didn't like it because it does not support both stacks since I have clients with Java stack too)

Hi, I am facing issues with the GetDeviceId function returning a value which is not related to either the Device ID or Player ID in the One Signal console.  GetDeviceId is returning a 16 character alphanumeric string, whereas the Device ID in OneSignal console is XX-XXXXX (X) and the PlayerID is XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX and doesnt look like they are substrings either.  

Any idea how i can get the specific PlayerID for a device so that I can store against a UserId for the logged in User and send specific workflow notifications to that user?  Maybe a new Cordova method needs to be added into the Plugin module specific for this?

The Devices entity in the OneSignalApi module appears to not be used anywhere as it appears to have been in previous versions.

how can i get DeviceID? Please

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.