Getting an error while adding FCM API Key to Azure Notification Hub - xamarin.forms

I have created a Azure Notification hub namespace, I'm trying to configure the Google FCM section of it by entering the API Key, but when I do that it is giving me this error
Error updating notification hub
{"error":{"code":"BadRequest","message":"Invalid Firebase credentials."}}
The Key I added it from the google-services.json file
But when I send a notification from FCM console, I'm able to send it and receive the notification.
Any inputs would be appreciated

Azure Notification Hub doesn't support FCM (yet) but GCM as I'm writing those lines.
You need to mention the server key available under your Firebase project settings in the Cloud Messaging tab. You should see something like this:
The key that you want to mention in Azure Notifications Hub is the purple one.
If Cloud Messaging API (Legacy) is disabled (which should be the case by default since it's deprecated), just hit the 3 vertical dots on the right and navigate to the only available menu "Manage API in Google Cloud Console". And just enable it :)

Related

Firebase Cloud Messaging (FCM) Api Key for Azure Notification Hub

I'm creating a Xamarin project to test Azure Notification Hub, but I'm having trouble going through the steps in this article
Under the section "Create a Firebase project and enable Firebase Cloud Messaging"
Step 6 is obsolete as Google seems to have changed their model to obtain a Server Key, or the Server Key does not apply to FCM.
Can anyone shed a light on how to obtain an Api key for Azure Notification Hub?
expanding DrDave's comment
From https://console.firebase.google.com/project/--your_project_name--/settings/cloudmessaging
Click on the three-dots menu of the "Cloud Messaging API (Legacy) 🚫 Disabled" Heading
Follow the offered link to manage in google cloud console, and there press the button to enable the googlecloudmessaging API
Wait a few minutes
Go back to your Firebase console Cloud Messaging Tab, and refresh.
See that the Cloud Messaging API header has changed to "Cloud Messaging API (Legacy) ✅ Enabled" and that a Server Key is now shown.
If you go to the Build section, Authentication menu item, and then click the 'Get Started' button, then navigate back to the Project Settings/General tab, you should see the API key.
EDIT: This is not the proper key for the Azure Notification Hub. See my comment below for the correct key.
There currently does not seem to be a proper answer to this.
When using FCM, if you head to the Authentication page on the Firebase Console for your app and select 'Get Started', follow the steps and then head back to the 'General' tab in your project settings page, you will see that it now has a Web API key.
This isn't useful for Azure Notification Hubs as if you try insert this key into the API key entry for a hub, it will not accept it.
The only answer seems to be to use the legacy GCM API, which is not ideal as it has been deprecated and certain APIs are no longer available.

Firebase push notification device to device

I am coding a React Native app and I using Firebase push notification service.
In my app, users can send message for each other and I want to notify them when they get message.
I found one way for native android I can code for react native it is not problem just I want to know if there is better way. I can make post to directly to Firebase service with using Http post.
This is the link which way I found: https://blog.usejournal.com/send-device-to-device-push-notifications-without-server-side-code-238611c143
I want to push notification to specific device without server, is there another way to do this?
Sending a message to a device with Firebase Cloud Messaging requires that you specify the FCM server key. As its name implies, this key is supposed to only be used in trusted environments, as knowing it allows one to send any message they want to all users of the app. For this reason it is not possible to secure send messages directly from one device to another device with FCM.
Instead you will have to run code in a trusted environment, such as your development machine, a server you control, or Cloud Functions. Your client-side application code invokes the server-side code, that ensures the call is authorized, and then calls the FCM API.
For more on this see:
How to send one to one message using Firebase Messaging
How to send device to device messages using Firebase Cloud Messaging?

Show notification based on a Firebase values

I want to show notification in my app even if the app is closed.. I don't need Firebase's Push Notification Service. The idea is similar to WhatsApp's message notification service.
When a value is added to firebase by a user another user should receive notification that there is a value change
Can someone tell me how this is done and What should I use to achieve this?
Push notifications for all major apps run through APNS for iOS, and Firebase Cloud Messaging for Android. While the apps may use a higher-level service from their application code, those services depend on APNS and FCM for the actual message delivery.
To see an example of how to build a notification system on top of this, based on values being written to a database, see Send Firebase Cloud Messaging notifications for new followers.

Firebase console

I'm still new with Firebase cloud messaging.
Whenever I send a push notification to an app, does it get recorded in this table in the firebase console like in the image below?
That only shows notifications that you compose at the console. It doesn't show messages that you send programmatically with the Admin SDK or HTTP API.

push notifications ionic 2 for android

I need to configure push notifications for an Ionic 2 application for android devices.
I read here that in order to do that you need to login to Firebase console, create a project and so on...
So my question is, do I really need to log into Firebase to do this? I'm not using firebase in my app, so I don´t get why I need to create a project to get a SERVER_ID and SERVER_KEY. What if I delete that project in Firebase afterwards, then my push notifications will stop working?
Thanks
Yes, you do need an account to use Firebase Cloud Messaging because you'll need a key to send pushs.
You need the key to use device-to-device push via HTTP and you need a project to send notifications to a group or topics.
I don't think that there's a way to use push without creating an account in any service.
You don't need a Firebase account.
You can use azure notifications hub or amazon aws or google cloud service, ionic cloud, etc.
Any cloud services that provides a notification hub which is basically a server for receiving and redistributing to the registered parties to the specific platforms.
Please note that some of these are specifically mobile oriented meaning you wont have to write any server side code and others aren't.

Resources