I am trying to integrate Urban Airship Push notification service in my android project.I have created a new project in google developer console and created a GCM server key.I added that GCM key in Urban Airship configuration as well,but it fails to send the notification.
The Urban Airship Error Console throws an error like
Received push with invalid authorization on platform GCM error message
I already created a test project in google developer console 2 months back, and having a valid GCM key. If I integrate this key in UA it works fine. But If I create a new server key in same project that is not working.
API key 4 is recently created but it is not working the Server Key created on June 9th works fine. Is this because the key is auto generated? If that is the issue, how do I auto-create the GCM server key?
Recently, I heard that GCM is migrating to Firebase. Do I need to use FCM key instead of GCM?
Seems that Google is no longer authorizing the API Keys created by Google API Console. I had a similar issue with Amazon SNS, and managed to fix it by using the Firebase auto-generated server key.
1 - Login into Google Firebase console, with the same credentials you used for Google API Console.
2 - Create a new project (or import an existing one).
3 - Click on the gear icon and select Project Settings
4 - Select CLOUD MESSAGING tab.
There you will see both the API Server Key and the Project number (which is needed in the application). This API Server key is the one you need to introduce in the Push Provider console (Urban Airship in your case).
Related
I am currently using Firebase Cloud Messaging FCM for push notification.
Try to configure the Azure Push Notification for Xamarin Android. I need to place some api key to the azure push notification portal. The portal at the moment refer "Google GCM" and require an API Key.
I use keytool for debug.keystore to get the SHA1 etc and put it in the API Key field in the azure push notification portal
{"error":{"message":"SubCode=40000. Failed to validate credentials with GCM. The remote server returned an error: (401) Unauthorized...
Can anyone tell what does that mean. Am I using the wrong key.
In the Firebase Console, go to your project and go to "Settings". Under settings go to the "Cloud Messaging" tab. On that tab there is a "Server Key". That is the key to use in Azure. Other instructions online say to use the google-services.json api key but that is incorrect.
https://stackoverflow.com/a/46473817/6617
as answered at here : https://stackoverflow.com/a/27161060/5370550
SubCode=40000. Failed to validate credentials with GCM.
This will probably fix this error:
Under the SERVICES tab in the APIs console for Google devs:
enable Google cloud messaging for android
I am building an push notification service using https://github.com/geeknam/python-gcm
this requires an API_KEY and Registation ID of device to send message.
I have created an app on console.developers.google.com and have got the API_KEY.
Now i have no clue how to get the Registration ID.
Are there dummy app(s) on installation of which it will return registration ID or something like that ?
I have created an app on console.developers.google.com and have got the API_KEY.
You'll only be able to get a valid Server Key when you create a project in Firebase Console. API Keys (recently) generated in the Developer's Console would not work for GCM (and FCM). From the note in the docs (under Server Key):
Starting from September 2016, you can create new server keys only in the Firebase Console using the Cloud Messaging tab of the Settings panel. Existing projects that need to create a new server key can be imported in the Firebase console without affecting their existing configuration.
Are there dummy app(s) on installation of which it will return registration ID or something like that?
You'll have to create your own dummy app where you'll have to call the getToken() to generate a Registration token (aka Registration ID). See the FCM Quickstart in GitHub.
Recently, every time I try to add or modify the GCM API Key in an Azure Notification Hub, I get the following error:
SubCode=40000. Failed to validate credentials with GCM. The remote
server returned an error: (401) Unauthorized...
I have tried using the same key that works in other Notification Hubs, as well as creating a new one via the Google Developer's console.
I've also recently come across articles stating that GCM is moving to FCM (Firebase Cloud Messaging). Could this be the cause of my issue? Is Google beginning to no longer support GCM?
There are two important informations:
Firebase Cloud Messaging (FCM) is the new version of GCM
So we should prefer Firebase Console instead of Google Cloud Console,
There is a useful article here Enabling Google Cloud Messaging (Firebase)
So we need to enable Google Cloud Messaging in Firebase Console for your added Android App.
Step by step:
-- Open your Firebase Console
-- Add your Android app in Firebase Console.
-- Go to Settings
-- Click CLOUD MESSAGING tab.
-- Take Legacy Server key there and use it in Azure Push Notification Service for Google(GCM) settings and Save it. That's all.
This article helps you how to create a Notification Hub Service in Azure then how to connect your Android or IOS App to Firebase Console etc.
Could you make sure that 1) you have enabled Google Cloud Messaging for Android in your cloud push account and 2) you are creating a new Server Key?
Also, use try sending a push notification from the command line to validate that the key is working with GCM directly. If that works, then Azure portal should accept the key. If that's not the case, please leave a comment.
I want to use push notification service on my Android project, but when I try to generate a server key, I notice that Google's developers console changed and I can't find where I can generate my server key. I looked at a lot of tutorials but still I can't do it.
Update: There is now a visible note in the GCM docs saying:
Starting from Sept. 2016 new server key can only be created in the Firebase Console using the Cloud Messaging tab of the Settings panel. Existing projects that need to create a new server key can be imported in the Firebase console without affecting their existing configuration.
Just retrieved a part of my answer here.
Go to your Google Developers Console
On the left-pane, click on Credentials
Under the Credentials Tab, Click on Create Credentials
Select API Key
Select Server Key
Fill out the details.
Click on Create
The Server Key should be available by then.
PS: Just tried it out, this still is a way to generate a Server Key.
please consider changing from google cloud messaging to firebase cloud messaging
google now recommend developers to use FCM instead of GCM
link here: https://firebase.google.com/features/
When using the API key generated for my project from Google developer console in the server side to send GCM - Push notifications, i am getting a 'MismatchSenderId' error. I have cross checked the sender ID in my application and the API key also, which is correct.
Also when creating an API key for push notification implementation, should i go for 'Server key' or 'Browser key' or 'Android key' .I have maps implementation also in my project.
I am new to push notification implementation, so kindly excuse if question is too broad.
when creating an API key for push notification implementation, use:
Server Key to send from your server
Browser Key to send from a web app
Android Key to send from an android app.
also the Sender Id, is really the project id.