pushwoosh icon indicating copy to clipboard operation
pushwoosh copied to clipboard

how do i know the devices id that i want to notify ?

Open survivaltravel opened this issue 8 years ago • 5 comments

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

survivaltravel avatar Apr 09 '16 02:04 survivaltravel

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

survivaltravel avatar Apr 14 '16 01:04 survivaltravel

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

pedroandrade avatar Apr 14 '16 03:04 pedroandrade

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 avatar Apr 14 '16 03:04 survivaltravel

@survivaltravel sorry, but I don't know if this format is correct :sob:

pedroandrade avatar Apr 14 '16 03:04 pedroandrade

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.

vindia avatar Jun 13 '16 13:06 vindia