Azure Notification: how to configure FCM for android - android

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

Related

How to get registration token for FCM push notification 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.

Quickblox: Unable to get push Notifications with FCM getting errr 401

I want to implement push notification in app by FCM.
The app is successfully getting FCM pushnotification but when i want to send from Quickblox admin pannel then that give me error like
error_description":"Unable to deliver notification 20860148, received error 401 (Unauthorized, check your App auth_key.)
This is log.json file :-
{"notification":{"registration_ids":["dA_lOjHQU2M:APA91bHB0zGuoalZoxtdcstBQ0dL0pPJA5HyUaoPVibD2iqnrUA51NLqrrmY5zrTZV7OaP55nUEber9NLkPs_ENkVtHLvbEAcHTrgh8wl_YoNhRsUNdyeIWt0mPDKk0tCDyLssXRuFu8"],"delay_while_idle":false,"data":{"message":"hii tesas","collapse_key":"event12616627"},"priority":"high","time_to_live":86400},"
log":[{"device_token":null,"created_at":"2016-12-14T09:56:50Z","delivered_at":null,"failed_at":"2016-12-14T09:56:51Z","error_code":401,"error_description":"Unable to deliver notification 20860148, received error 401 (Unauthorized, check your App auth_key.)"}]}
Because of GCM deprecate now so You are required to put Firebase Cloud Messaging (FCM) API Server key in your Quickblox Push notification panel go to setting and paste FCM Server key in Android-> Develpment or Production. Make sure you put Firebase Server Key there.
Follow these steps to get the server key:
Log into Firebase console https://console.firebase.google.com/
Add your project or select your project if you are already added
now click on setting icon go to project setting -> cloud messaging. there you can find your server key copy that key and paste in
There you should have your Server Key.
Hope this helps!
You are required to put Google Cloud Messaging (GCM) API key in your Quickblox Admin panel. Make sure you put Google Server Key there.
Follow these steps to get the server key:
Log into Google api console https://console.cloud.google.com/apis/
Go to "Credentials" in the navigation on the left side.
There you should have your Server Key.
Hope this helps!

Android - GCM server key is not working with Urban Airship

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

Azure Notification Hub no longer accepting GCM API Key

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.

GCM - How to Generate a Server API Key For Android Push Notification

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/

Categories

Resources