Anim
Posts: 0
Joined: Fri Jul 03, 2015 10:45 am

Token "Undefined" in device collection. Cannot send push notification for Android.

I followed the tutorial and created a test APP and I can send my PUSH successfully. When tried to implement the same in my LIVE app I am getting Token value as "UNDEFINED" in device collections.

When I try to send out PUSH messages, I get error "invalidRegistration" and the row in the collection with undefined token is deleted.

As suggested in previous suggestions in this forum, I added

setTimeout(function() {
alert(localStorage.getItem('pushNotificationDeviceID'));
alert(localStorage.getItem('pushNotificationToken'));
}, 1000);

I get DeviceID but Token is "Undefined" !!!!

I double checked Sender ID and API Key, they all are same is defined in GOOGLE.

Any help is much apprenticed.

-Vibhu

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

Token "Undefined" in device collection. Cannot send push notification for Android.

Hello Vibhu -

Could you please clarify, what do you mean by "live app" here?

Recreate your Sender ID/API Key and try with new keys, and would be obligatory for such case to delete app from device and re-build it and re-install it on the device.

Anim
Posts: 0
Joined: Fri Jul 03, 2015 10:45 am

Token "Undefined" in device collection. Cannot send push notification for Android.

Hello IIIya,

Thanks for prompt reply, here Live APP means the app which is already build and used by the users.

I tried the above mentioned steps of generating new Sender ID and API Keys but did not get any success. I also deleted the app from device and re-installed it.

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

Token "Undefined" in device collection. Cannot send push notification for Android.

And could you clarify, you have re-published your app? And re-connected database to your new app version?

Which device with what OS version you're using for testing?

Anim
Posts: 0
Joined: Fri Jul 03, 2015 10:45 am

Token "Undefined" in device collection. Cannot send push notification for Android.

Hi IIIya,

I have not republished the APP yet. Its still under testing. I am exporting Binary (.apk) file and installing to my device.

OS Version: 4.4.2

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

Token "Undefined" in device collection. Cannot send push notification for Android.

Please try re-link it with new database and try it this way. Re-build, delete it from device and install new app and check database record for new device.

Anim
Posts: 0
Joined: Fri Jul 03, 2015 10:45 am

Token "Undefined" in device collection. Cannot send push notification for Android.

Hello Illya,

I created a new DB and added it to my APP. Still no luck, token is Undefined still.
Moreover I created a small testing APP and linked to the new DB, it works fine and I get token populated.

Anim
Posts: 0
Joined: Fri Jul 03, 2015 10:45 am

Token "Undefined" in device collection. Cannot send push notification for Android.

Hello Illya,

I created new APP, from the template of my old APP which is not working. I was surprised,the new APP worked. I check for the jQuery library version. It was a mismatch.
The new APP was using v2.0 and the old APP was using v2.1.
I changed jQuery Library for old APP to v2.0 and v2.2 and tested both the scenarios, still no luck. Token is still undefined for the old APP.

Vibhu..

Anim
Posts: 0
Joined: Fri Jul 03, 2015 10:45 am

Token "Undefined" in device collection. Cannot send push notification for Android.

Hi Illya,

Any updates on this??

Vibhu

Anim
Posts: 0
Joined: Fri Jul 03, 2015 10:45 am

Token "Undefined" in device collection. Cannot send push notification for Android.

Hello Illya,

The problem is solved now.
Below is the root cause of the problem:

In past we have customized, "ANDROIDMANIFEST.XML" file and "uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" " was missing from the code. On careful examination of this XML, we figured it out.

Cheers !!!
Vibhu

Return to “Issues”