I am developing an app using ionic2 and I am using OneSingal to send notification 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?
1 Like
it’s a bit late i guess, but as it may help others trying to do so i post this answer hoping it might come handy
after your endInit()
you can get the player id and the device token from this built-in function
constructor(private oneSignal: OneSignal, . . . ){}
.
.
this.oneSignal.endInit();
this.oneSignal.getIds().then((id) => {
console.log(id);
let alert = this.alertCtrl.create({
title: 'the onesignal ids object',
message: JSON.stringify(id),
buttons: [{
text: 'Ok',
role: 'ok'
}]
});
alert.present();
});
13 Likes
This worked for me Thanks a lot
1 Like
Thanks a lot. It’s worked fine for me.
1 Like
I didn’t understand after a user subscribed. How will the user subscribe?
thanks dear its working for me too