I want onesignal to be able to send push notification to a specific device.
How do I capture the device id of the device ?
And what API do I use to push to that specific device ?
Thanks.
Here is a copy of OneSignal's guide on sending a notification to an individual device:
If you're looking to send notifications to only your test devices:
Tag your devices with a unique tag with sendTag
.
OneSignal.sendTag("is_test", "true")
Create a new Segment on the OneSignal dashboard named test devices.
If you're looking to send notifications to a specific user device: (Can be used for User-to-User notifications)
player_id
with the getIdsAvailable
SDK method.
userId
from the getIdsAvailable
callback if the pushToken is not null or blank to your server.include_player_ids
to the userId on the PostNotification SDK method or on the create notification REST API call.