SteveLacy
Posts: 6
Joined: Fri Apr 20, 2012 11:54 pm

pushNotificationToken returning null on iOS8 devices

I'm using the following javascript to get device info:

setTimeout(function() {
// push notification stuff...
var deviceID = localStorage.getItem('pushNotificationDeviceID');
var tokenID = localStorage.getItem('pushNotificationToken');
var deviceType = device.platform;
}, 3000);

I've found it works great on all Android devices, but I've found that the pushNotificationToken is returned null on iOS devices running iOS8 or earlier. It works properly on iOS9 devices.

Is there a workaround I could use to get the pushNotificationToken on iOS8 devices?

Thanks,

Steve

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

pushNotificationToken returning null on iOS8 devices

Hello Steve -

Could you please check what Push notification plugin is enabled in your Cordova plugins App settings for your project.

SteveLacy
Posts: 6
Joined: Fri Apr 20, 2012 11:54 pm

pushNotificationToken returning null on iOS8 devices

Ah. I see I have PushPlugin 1.3.0 enabled while PushPlugin 1.4.5 is not. Should I enable them both? Or just the PushPlugin 1.4.5?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

pushNotificationToken returning null on iOS8 devices

The PushPlugin should be selected automatically, based on when your app was created before our 24th release or after.

I'm using PushPlugin 1.4.5 and I think that here token ID variable is not available on the Device ready event, you can try it to read it on the "Push registration success" event in app - after the PushPlugin has been initialized and token ID created for your device. This way should be correct and work, I've just tested this on the device running iOS8.

B5107656409
Posts: 0
Joined: Thu Jul 23, 2015 6:39 am

pushNotificationToken returning null on iOS8 devices

Hi Illya Stepanov

..you can try it to read it on the "Push registration success" event in app ...

what do you meant? .. could you please more detail.?.. i did not find such event.. where can I find it?

B5107656409
Posts: 0
Joined: Thu Jul 23, 2015 6:39 am

pushNotificationToken returning null on iOS8 devices

in DeviceReady.. I got null for deviceid and tokenid

setTimeout(function() {
var deviceid = localStorage.getItem('pushNotificationDeviceID');
var tokenid = localStorage.getItem('pushNotificationToken');

Code: Select all

 alert('token: ' + tokenid + '   deviceid : ' + deviceid); 

}, 1000);

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

pushNotificationToken returning null on iOS8 devices

In this section you can find all Push events: https://docs.appery.io/docs/pushnotif...

Check whether your device actually registered inside the Devices collection in your Database.

B5107656409
Posts: 0
Joined: Thu Jul 23, 2015 6:39 am

pushNotificationToken returning null on iOS8 devices

noted..
but when the Push registration success event would be triggered?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

pushNotificationToken returning null on iOS8 devices

Should be -- but you can also check if the device actually appears in the Database collection too.

Return to “Issues”