English
English
简体中文
Contact Us
Register
Log In

Configure Google FCM

Last Updated on : 2023-09-15 09:11:00download

This topic describes how to configure Google Firebase Cloud Messaging (FCM) to implement push notifications in an OEM app for Android.

Procedure

  1. Go to Google Firebase and follow instructions to register an account and log in to Google Firebase.

  2. Click App project.

    Configure Google FCM

  3. Enter your project name and click Continue.

    Configure Google FCM
  4. Click Not right now > Create project.

    Configure Google FCM

  5. Click Continue.

    Configure Google FCM
  6. On the Get started by adding Firebase to your app page, click the Android logo as denoted in the figure.

    Configure Google FCM

  7. Fill in the package name of the app in the Android package name field and click Register app. The package name can be obtained from the Tuya IoT Development Platform.

    • Recommended format of the package name: com.xxx.xxx
    • App nickname: optional

    The package name must be correct. Otherwise, push notifications cannot be received.

    Configure Google FCM

  8. Click Next.

    Configure Google FCM

  9. Click Continue to console.

    Configure Google FCM

  10. In the top left corner of the console, click ⚙️ > Project settings.

    Configure Google FCM

  11. Click General > google-services.json to download this file.

    Configure Google FCM

  12. Go to Tuya IoT Development Platform > App > OEM App > Required Setting, select the target app, and then click the Certificate for Android tab.

    Configure Google FCM

  13. Find Configure Google FCM > Upload JSON file and upload the google-services.json file downloaded in the previous step.

  14. Perform the following steps to get the information to be entered in Sender ID and Server Key:

    1. Return to Google Firebase, go to cloud messaging > Cloud Messaging API (legacy), and then click the kebab menu icon > Manage APIs in Google Cloud Console.

      Configure Google FCM

    2. In the Google Cloud Console that appears, click Enable.

      Configure Google FCM
    3. Return to Cloud Messaging API (legacy) and refresh the page to see the values of Server key and Sender ID.

      • Copy and paste the token of Server key to the Server Key field in Configure Google FCM on the Tuya IoT Development Platform.
      • Similarly, copy and paste the value of Sender ID to the Sender ID field on the Tuya IoT Development Platform.

      The values of Server Key and Sender ID must be correctly entered. Otherwise, push notifications cannot be received.

      Configure Google FCM Configure Google FCM