0

I have a Azure Notification hub that's hooked up to a FCM instance. I am able to send notifications to my app using the Firebase console. There is a component which registers my device and changes to the build.gradle files which link the device and FCM (following this guide https://enappd.com/blog/firebase-push-notification-in-ionic-react-capacitor/111/). But I want to use an Azure notification hub instead.

What needs to be added to the gradle.build/google-services.json/any other files for the app to be linked with Azure? Thanks.

James Brightman
  • 857
  • 2
  • 13
  • 23

1 Answers1

0

Ok so after a bit of digging i've solved this issue. I'll list the steps below -

  • Run npm i in your ionic-react app and then npx cap add android then npx cap open android.
  • Register on Firebase following this guide. Download the google-services.json file. Add this file to the android/app/ folder. Then add apply plugin: 'com.google.gms.google-services' to the bottom of the build.gradle in the android/app/ folder.
  • Go back to the firebase console > project overview > project settings > cloud messaging and copy the server key.
  • Paste the server key into your Azure notification hub under the Google (GCM/FCM) tab and save. Azure and Firebase are now linked.
  • Plug in a device and run your app from Android studio.
  • Register for push notifications in your app (code for this found on link above).
  • App is now able to receive notifications.

I don't think this is a fully 'correct' answer as you cannot send manual test notifications from Azure to Android, but it satisfies my requirements and is hopefully helpful to someone else. Thanks.

James Brightman
  • 857
  • 2
  • 13
  • 23