Nouf
Nouf

Reputation: 773

ionic2 - How to get PlayerId after user subscribes in OneSingal

I am developing an app using ionic2 and I want to retrieve the player id so I can store in my DB so my question is how to can I retrieve the OneSignal users' unique player after a user subscribes?

Upvotes: 1

Views: 523

Answers (1)

Swapnil Patwa
Swapnil Patwa

Reputation: 4099

I assume you have already installed and configured OneSignal plugin. Following is the code to get PlayerId-

 this.oneSignal.getIds().then(ids => { 
    console.log(JSON.stringify(ids['userId']));   //PlayerId
 });

Upvotes: 1

Related Questions