Skip to content

Enabling Firebase Service (Push Notification)

Enable Firebase Service on Android

You will need google-services.json for the Firebase Cloud Messaging (FCM) configuration on Android. Please follow the steps to set up notification on Android.

Steps

  1. Create an Android application on FCM console.

  2. Fill in the information of your Android app.

  3. Download google-services.json.

  4. Click "Next" to skip the steps for native Android app below.

    • Move google-service.json to Android app module root directory
    • Add Firebase SDK
  5. Stay at the 4th step on the FCM Setting page.

    Note

    This step is to verify whether your application registered FCM from the client app or not. You will need to build an app to verify it.

  6. Copy google-services.json file to the root folder.

    Note

    1. If you can't pass the installation verification, please see the readme of the plugin we use to find out for more information.
    2. After your App is built, please check for the installation verification status shown on FCM setting page.

Enable Firebase Service on iOS

You will need .p8 APNs key for the FCM authorization and GoogleService-Info.plist for the FCM configuration to set up notification on iOS.

Generate .p8 File of APNs Key

Please follow the "Create the authentication key" section of the FCM instruction to generate a .p8 key file containing your APNs Auth Key.

Set Up APNs Key on FCM Console

You need to add an Apple Push Notifications service (APNs) key in Apple Developer in advance. Go to Apple Developer → Certificates, Identifiers & Profiles → Keys, and add a key as showed below:

After you get the APNs' key ID, please also have your Apple team ID at hand and follow the steps to set up APNs key on the FCM console.

Steps

  1. Go to FCM project settings.

  2. Go to Cloud Messaging tab.

  3. Go to iOS app configuration section and click Upload under the APNs Authorization Key section.

  4. Choose the .p8 file and input APNs key ID, Apple team ID. Click Upload to complete the setting.

Set Up Notification on iOS

Follow these steps to prepare GoogleService-Info.plist for the FCM configuration on iOS.

Steps

  1. Create an iOS application on FCM console.

  2. Fill in the information of your iOS app.

  3. Download GoogleService-Info.plist.

  4. Click "Next" to skip the steps for native iOS app below.

    • Move GoogleService-Info.plist to Xcode project.
  5. Install CocoaPods and run pod setup to initialize it. You can skip the steps in the setting page.

  6. Click "Next" to skip the steps for native iOS app below.

    • Add initialization code
  7. Stay at the 5th step on the FCM Setting page.

    Note

    This step is to verify whether your application registered FCM from the client app or not. You will need to build an app to verify it.

  8. Copy GoogleService-Info.plist to the root folder.

    Note

    1. If you can't pass the installation verification, please see the readme of the plugin we use to find out for more information.
    2. After your App is built, please check for the installation verification status shown on FCM setting page.

Generate Firebase Private Key

You need to provide the Firebase private key to Exosite team to complete the push notification setting.

Steps

  1. Click the settings (cogwheel) icon at the top of the Firebase Console.
  2. Choose Project Settings.

  3. Click on the Cloud Messaging tab and enable Firebase Cloud Messaging API (V1).

  4. Go to Service account tab and click generate new private key to download a json file.
  5. Please provide the json file to Exosite for the final setting.

Update Your Project

Steps

  1. Open package.json under project root.
  2. Add "@awesome-cordova-plugins/firebase-x": "^6.8.0" under "dependencies" part.

  3. Add "cordova-plugin-firebasex": "16.4.0" under "devDependencies" part.

  4. Add the following under "cordova" —> "plugins"

        "cordova-plugin-firebasex": {
            "IOS_STRIP_DEBUG": "true",
            "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
            "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
            "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
            "FIREBASE_FCM_AUTOINIT_ENABLED": "true"
          }
    


Have more questions? Submit a request