andi
Posts: 0
Joined: Sat May 25, 2013 9:32 am

Push notification to specific device

I try to get push notification running,but i don't know how to get the device id which i should enter into the DeviceID Field on the page https://appery.io/backend/push#send_tab
I tried the value from device.uuid but nothing happens
if i leave the value blank the notifications works

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Push notification to specific device

Hi Andreas,

DeviceID is a device serial number. You can get it calling JS function:
codePushNotification.getDeviceUniqueIdentifier();/code
This tutorial may be helpful: http://docs.appery.io/tutorials/sendi...

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Push notification to specific device

Does
code
PushNotification.getDeviceUniqueIdentifier();
/code
Give same result as
code
localStorage.getItem('pushNotificationDeviceID');
/code

My assumption is Appery runs the first one (built-in) to generate the local storage value ?

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Push notification to specific device

bump

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Push notification to specific device

one minute:)

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Push notification to specific device

PushNotification.getDeviceUniqueIdentifier() - is a function where you need to send callback function as an argument.
In localStorage variable pushNotificationDeviceID stores an identifier. It's recorded there while app start by using the PushNotification.getDeviceUniqueIdentifier() function (result of PushNotification.getDeviceUniqueIdentifier() is recorded to localStorage of pushNotificationDeviceID variable while app start). If you need identifier you should get it through localStorage.getItem('pushNotificationDeviceID');

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Push notification to specific device

Ah... So like
code
pushNotification.getDeviceUniqueIdentifier(function(id){
alert(id);
});
/code
No point duplicating so I will just use the localStorage.getItem('pushNotificationDeviceID'); for device id
and
localStorage.getItem('pushNotificationToken'); for token

Thanks!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Push notification to specific device

Yes, you're right.

andi
Posts: 0
Joined: Sat May 25, 2013 9:32 am

Push notification to specific device

Yes it works ...

One thing i have tried some time till i found it, it only works on APP's on devices not with the appery Test App

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Push notification to specific device

I have created a localStorage variable called 'pushNotificationDeviceID' for my app. Does this get automatically populated with the device ID when opened on a mobile device or do I need to create a service to do so? I am writing this variable back to a database but its not populating when I open app on my android device which is why I am asking.

Thanks,
Aeneas

Return to “Issues”