Device shown as Not Active

Hi, I try to do a push notification and below is the portion of the codes I used from the sample.

1. I manage to get a device (Android) registered and appear in the Devices List.
2. When I try to send Push Notification, it will show there is 1 Active device.
3. But the device never receive the push notification.
4. Next I check again the devices is shown as Not Active.

5. I also try to run the Sample directly and it can work and receive the Push Notification, so I think the problem might lies in my apps' code and not the device.
6. Is there anything I miss out?

001.//This is your Telerik BackEnd Services API key.

002.varbaasApiKey = 'removed';

003.

004.//This is the scheme (http or https) to use for accessing Telerik BackEnd Services.

005.varbaasScheme = 'http';

006.

007.//This is your Android project number. It is required by Google in order to enable push notifications for your app. You do not need it for iPhone.

008.varandroidProjectNumber = 'removed';

009.

010.//Set this to true in order to test push notifications in the emulator. Note, that you will not be able to actually receive

011.//push notifications because we will generate fake push tokens. But you will be able to test your other push-related functionality without getting errors.

Anton Dobrev

When an Android push notification is created in BS, the payload along with the tokens of the targeted devices are sent to Google Cloud Messaging for Android. GCM sends the notification to the devices or returns an error if a token is invalid. The devices with an invalid token are marked as Active: false in the Backend Services data browser. You can read more in this documentation article.

In order to identify the problem on your side could you please verify the following:

The notifications for the app are allowed. You can check this under Settings > Apps > MyPushApp on your Android device. Notifications are enabled by default in Android.

The device is not registered in Everlive with a push token like: "fake _push_token".

The sample app is deployed to an Android device and is not tested in the AppBuilder companion app.

The project number for your Google API project (a 12 char string) is entered in the client app as a value to the androidProjectNumber variable.

The API key for server applications (a 39-char string) is entered in the backend portal under Settings > Push Notifications > Android. How to obtain it is explained in this article: Enabling GCM - Getting Started

Anton Dobrev

I tried your code and it is running as expected. For your convenience I attached the project. To run it import in in your favorite Appbuilder client, and enter your Backend Services API key and Google API Project number (the 12 digit number of your project in the Google Developer API) as strings. Also, find attached a screenshot so that you can confirm if this is the expected behavior of the app. The only changes that I made were to add the external libraries from a CDN and import your code in index.js and index.html.

In addition, for further information about this matter you can examine our documentation article about the push workflow in JS applications and the official demo app.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.