pushwoosh
pushwoosh copied to clipboard
how do i know the devices id that i want to notify ?
Hi,
Just a dumb question, how do I get the device id that I want to notify ? How do I map it with the user ?
Pushwoosh.notify_devices(message, devices, other_options)
Thanks. Firdaus
basically im using ionic, im able to get the device id with
device.uuid using cordova-plugin-device
ios works fine but android does not.
ios example that works: 8A4548B9-868C-41CD-9B3E-DA04CA11610D
android example that does not work: 8ad257a38d88191 <-- is this format correct ?
Thanks
hi @survivaltravel, the device id is your push registration token, when you register the device through the android sdk, you be able to get it
thanks @pedroandrade for the tip. I am still trying.
Does this format look right for android based device id ? 8ad257a38d88191 <-- is this format correct ?
Thanks.
@survivaltravel sorry, but I don't know if this format is correct :sob:
Hi @survivaltravel how I've fixed this is by leveraging the tags functionality in Pushwoosh. This means I've created at tag user_id
in Pushwoosh and on login I fill this with the right user id. I can then target specific users with the following code:
# Replace user.id with the actual user id
Pushwoosh.notify_all "Hello!", conditions: [["user_id", "EQ", user.id]]
Cool part is, when the user logs out I set the value of the tag to ""
, so the user only receives the push notification on the devices they are logged in on.