Page 1 of 2

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

Posted: Mon Jul 06, 2015 8:47 am
by Anim

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


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

Posted: Mon Jul 06, 2015 7:48 pm
by Illya Stepanov

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.


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

Posted: Tue Jul 07, 2015 1:46 am
by Anim

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.


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

Posted: Tue Jul 07, 2015 5:43 am
by Illya Stepanov

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?


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

Posted: Tue Jul 07, 2015 5:48 am
by Anim

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


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

Posted: Tue Jul 07, 2015 9:08 am
by Illya Stepanov

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.


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

Posted: Tue Jul 07, 2015 9:50 am
by Anim

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.


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

Posted: Wed Jul 08, 2015 3:30 am
by Anim

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..


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

Posted: Thu Jul 09, 2015 8:50 am
by Anim

Hi Illya,

Any updates on this??

Vibhu


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

Posted: Fri Jul 10, 2015 8:53 am
by Anim

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