This question already has answers here:
Where can I find the API KEY for Firebase Cloud Messaging?
(12 answers)
Closed 4 years ago.
I am very new in both Android Development and fcm. I have been building a mobile app, and I want to use Firebase Cloud Messaging
to push notifications to particular users(by making them subscribing to different topics). I've already created a Java Server (apart from the mobile app) but I could not figure out how to test it on my application because I don't know how to find fcm key for my application if there is any. Is there a way to test my server locally or is it obligated to have an application registered to Google Firebase? Any help would be appreciated, thanks in advance.
Yes you can.
The FCM API key (Server Key) can be found in the firebase console under your project :
Project Settings > Cloud Messaging
Is there a way to test my server locally or is it obligated to have an application registered to Google Firebase?
You definitely need to register your application to firebase to use FCM and get the key.
I could not figure out how to test it on my application because I don't know how to find fcm key for my application if there is any.
After you register your app to firebase and link it to your Android studio project,
(https://firebase.google.com/docs/android/setup)
Go to your project settings in firebase,
In your project settings, click on Cloud Messaging, the Server Key is your FCM KEY
Follow this to send message from your server to device. You can also use firebase console to do that,
How can I send a Firebase Cloud Messaging notification without use the Firebase Console?
Related
This question already has answers here:
How to send one to one message using Firebase Messaging
(5 answers)
How can I send a Firebase Cloud Messaging notification without use the Firebase Console?
(17 answers)
Closed 2 years ago.
This might be a duplicate questions, but still. I have seen many tutorials on sending notifications from Firebase Cloud Messaging to an android app, but I don't understand how to send notifications from my angular website to firebase, which will then push these notifications to android app. In all these tutorials, they have sent notifications by manually typing messages in the firebase UI.
My question how do I send notification data from my angular website to FCM, which will then send these notifications to my android app? Any references for this? Any procedure to follow?
In your case, you might consider having your own app server that will provide an API for your angular app to send notification. Here's a documentation on how you can send a notification to a device from your server.
https://firebase.google.com/docs/cloud-messaging/send-message
There are different parts of this implementation actually. First, your app server needs to provide an API to the Android app that will be used to send the firebase registration token from your app when the app is launched. You might consider storing those registration tokens in your backend database.
Then the other API that your server will provide, to send notification, can be integrated in your angular app. The server API should be able to find the exact registration token of the device where you need to send the notification and will call the API from FCM to send the notification to the device. Here's the API doc that you might consider taking a look into.
https://firebase.google.com/docs/cloud-messaging/http-server-ref
Here is a good tutorial that shows how you can implement the server side implementation to send the notification.
https://www.pluralsight.com/guides/push-notifications-with-firebase-cloud-messaging
I need to be able to see registered FCM tokens in Firebase Console so that I can send specific test notifications. Is there a way to setup Firebase to store the FCM tokens locally in the Firebase project?
If the solution is to add codes to the app, that may be a problem for me as I am using an external app developer to develop my app and he is currently unavailable to make any changes in the app.
So I am just looking for a way for me to easily see all registered FCM tokens within the Firebase Console.
I am trying to migrate my Android app from GCM to FCM.
I use Google Cloud project for GCM and Firebase project for some Firebase features (Analytics, etc.) now.
Docs say that I need to import Google Cloud project to Firebase, but I already have Firebase project for my app.
As I understand, it is needed to provide GCM and FCM tokens compatibility.
So, how to link existing Firebase and Google Cloud projects?
If it is impossible, is it possible to send messages to old tokens using new FCM endpoints and which credentials (Google Cloud or Firebase) should be used for it?
All Firebase project are also Google Cloud projects. You don't "link" them together - they are the same. They have exactly the same configurations and service accounts.
When you imported Firebase into your existing Google Cloud project, what you did was add Firebase APIs to it. Now you should be able to use Firebase services with your same project. It sounds like you should just start using Firebase in your project as you would normally.
The GCM and FCM backends are essentially identical, except for the endpoint that you use to send messages. So, try sending messages to the new endpoint.
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.
Hi android developers,
Today I have decided to use Push notification of GCM. But getting stuck with creating key.
Steps I followed below steps provided in docs
Created project.
under API & Auth Google Cloud Messaging for android turned ON
Here I stuck, which key to choose. In docs it clearly says to select server key but in api key help doc says:
A.Create and use a server key if your application runs on a server.
B. Create and use an Android key if your application runs on Android devices.
My Question is I have developed an offline app which runs on android phone. So which key should I prefer? Also if anyone has done this push notification stuff then please share whole procedure in simple words.It will be great help.
Please help!
Thanks in advance.
you just have to create the public server key and shared it with your api developer which will used it for send push notification with using the Google Cloud Messaging.