Reputation: 61
I'm trying to use the sample code available here: https://github.com/ibm-bluemix-mobile-services/bms-samples-android-hellopush
And the first difficulty I found was on configuring the GCM - it seems that somethings changed since it was documented - anyway I guess I got everything configured correctly.
I got the app working and I'm able to register my device, but there is no notification when I try to send it. I'm using both the bluemix dashboard and the swagger to send a message. The response I get is that the message was sent, but I got nothing on the device (a mobile phone, not the emulator).
I checked my Google API dashboard, and there is no activity on the GCM api.
The application ID is: f97eb706-3375-438d-8221-cd7ac0266de1
Upvotes: 3
Views: 223
Reputation: 193
@Paulo For new projects the dashboard is not coming up to enable GCM API in https://console.developers.google.com. Steps to enable GCM: Create New Project->create API Key->Enable GCM. To Enable GCM please Navigate to Dashboard tab and search for Google Cloud Messaging-> Click on GCM and enable the API. Please wait for 5 min to get it activate.
Configure the GCM credentials for Push Notification-> register the device and send notification.
Upvotes: 1
Reputation: 61
I was using Postman to test the GCM API (https://android.googleapis.com/gcm/send) and I was getting an "Error 401 Unauthorized". I tried to create a new API Key, but without success.
After reading this: https://stackoverflow.com/a/22453025/6828416 I tried to create a new project on GCM, and it suddenly started to work.
Upvotes: 3
Reputation: 2488
The Docs are currently being updated for GCM, so that will be fixed very soon.
I attempted to recreate your problem and just tested out the sample with Push Notifications with the Android sample here (with the latest version of Android Studio v2.1.3):
Before:
After:
Here is how I edited my code snippets after cloning the sample (mock values):
Code Edit 1 Before:
BMSClient.getInstance().initialize(this, "<APPLICATION_ROUTE>", "<APPLICATION_ID>", BMSClient.REGION_US_SOUTH);
Code Edit 1 After:
BMSClient.getInstance().initialize(this, "http://imfpush.ng.bluemix.net", "dfadsfadsfdsf-2343-2334-8e82-421c02ce847c", BMSClient.REGION_US_SOUTH);
Code Edit 2 Before:
push.initialize(this, "<APPLICATION_ID>", "<CLIENT_SECRET>");
Code Edit 2 After:
push.initialize(this, "dfadsfadsfdsf-2343-2334-8e82-421c02ce847c", "edec64df-34fd-44e3-9d1e-dfsfsdf989899");
I got these values from the Push Notifications service credentials (mock values).
Here is how I set up GCM:
In my Bluemix config, it looks something like this (mock values):
Here's how I got those values from GCM (mock values):
Sender ID:
API Key:
Upvotes: 1