I use OneSignal for push notifications in an ionic application 2. To send targeted notifications to specific users I need to recover the OneSignal player_id.
Does anyone have any idea how to retrieve this id from the platform?
I use OneSignal for push notifications in an ionic application 2. To send targeted notifications to specific users I need to recover the OneSignal player_id.
Does anyone have any idea how to retrieve this id from the platform?
I found how to recover the player_id from the OneSignal plugin, and it's actually quite simple. In app.component.ts, I added the code:
window["plugins"].OneSignal.getIds(ids => {
console.log("player_id: " + ids.userId);
});
With this, I get the PLAYER ID of the user, allowing, for example, the sending of push notifications directed to the specific user.