Integrating FCM Push Notifications
- The FCM push channel is suitable for Android devices officially sold overseas (with built-in Google GMS services) and will be enabled in overseas network environments.
- It is recommended that you test the integration according to the conditions and steps described in Test FCM Push Notifications.
RC's server has integrated components for communication with the FCM backend. When the app running on the recipient's device is killed, suspended in the background, or remains in the background for more than 2 minutes, the IM SDK's long connection channel will be disconnected. In such cases, if a message needs to be delivered, the RC server will send a message request to the FCM backend, which will then deliver the message to the client app running on the user's device.
Integrate FCM into Android Projects
This section follows the workflow recommended by Google, describing how to add Firebase to your Android project via the Firebase Console. During this process, you must manually add plugins and configuration files to your project.
To help you quickly get started, the steps below have been simplified. For detailed steps, you can refer to the Google Documentation or the Firebase Chinese Documentation.
Prerequisites
- Install the latest version of Android Studio or update it to the latest version.
- Ensure your project meets the following requirements:
- (SDK ≧ 5.6.3) Use Android 5.0 (API 21) or higher;
- (SDK < 5.6.3) Use Android 4.4 (API 19) or higher;
- Use Jetpack (AndroidX), which requires the following versions:
com.android.tools.build:gradle 3.2.1
or highercompileSdkVersion 28
or higher
- Set up a physical device or use an emulator to run your app. Note that the FCM client is part of the Firebase SDK that depends on Google Play services, which requires Google Play services to be installed on the device or emulator.
- Log in to Firebase with your Google account.
To add Firebase to your app, you need to perform several tasks in the Firebase Console and the open Android project (e.g., download the Firebase configuration file from the console and move it to the Android project).
Step 1: Create a Firebase Project
-
In the Firebase Console, click Add Project.
- To create a new project, enter the project name you want to use. You can also modify the project ID displayed below the project name if needed.
- To add Firebase resources to an existing Google Cloud project, enter the project name or select it from the dropdown.
-
Click Continue. Finally, click Create Project (or Add Firebase if using an existing Google Cloud project).
Firebase will automatically provision resources for your Firebase project. Once this process is complete, you will be taken to the overview page of your Firebase project in the Firebase Console.
A Firebase project is essentially a Google Cloud project with additional Firebase-specific configurations and services enabled. When you create a new Firebase project, you are actually creating a Google Cloud project behind the scenes. For more details, refer to the Firebase Chinese Documentation Relationship Between Firebase Projects and Google Cloud.
Step 2: Register Your Android App with Firebase
To use Firebase in your Android app, you need to register your app with the Firebase project. This process is often referred to as "adding" the app to the project.
-
Go to the Firebase Console.
-
In the center of the project overview page, click the Android icon or add an app to start the setup workflow.
-
In the Android Package Name field, enter your app's package name.
- The package name is the unique identifier for your app on devices and in the Google Play Store.
- The package name is often referred to as the app ID.
- You can find your app's package name in the module (app-level) Gradle file (usually app/build.gradle) (example package name: com.yourcompany.yourproject).
- Note that the package name is case-sensitive and cannot be changed once you register this Firebase Android app with the Firebase project.
-
Complete other optional configurations if needed, then click Register App.
Step 3: Add the Firebase Configuration File to Your Android Studio Project
This step describes how to add the Firebase Android configuration file to your app.
-
After registering the app, click Download google-services.json to get the Firebase Android configuration file (
google-services.json
). -
Move the configuration file to your app's module (app-level) directory.
- For more details on this configuration file, visit Understanding Firebase Projects.
- You can download the Firebase configuration file again at any time.
- Ensure the configuration file name is not appended with additional characters, such as (2).
-
To enable Firebase products in your app, add the
google-services
plugin to your Gradle file.Note, all Firebase SDKs use the google-services Gradle plugin (
google-services
), but this plugin is not related to Google Play services.-
Method 1: Add the plugin using Gradle's
buildscript
block. Both Google Documentation and Firebase Chinese Documentation use this method.-
Modify the root-level (project-level) Gradle file (
build.gradle
) by adding a rule in the buildscript block to import the Google Services Gradle plugin. Make sure you add Google's Maven repository.buildscript {
repositories {
// Check if this line exists (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following configuration:
classpath 'com.google.gms:google-services:4.3.13' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check if this line exists (if not, add it):
google() // Google's Maven repository
// ...
}
} -
In your module (app-level) Gradle file (usually
app/build.gradle
), apply the Google Services Gradle plugin:apply plugin: 'com.android.application'
// Add the following line:
apply plugin: 'com.google.gms.google-services' // Google Services plugin
android {
// ...
}
-
-
Method 2: Use Gradle's plugins DSL. If you are familiar with Gradle's plugins DSL syntax and already use it in your project, you can use this method.
-
By default, plugins DSL only supports core plugins published in the Gradle Plugin Portal. Since the
google-services
plugin is not in this repository, you need to add Google's plugin repository address first.Declare Google's Maven repository in the root-level (project-level) Gradle settings file (
settings.gradle
).pluginManagement {
// (Optional) Introduce the google-services plugin and declare the version when declaring the repository
//plugins {
// id 'com.google.gms.google-services' version '4.3.13'
//}
repositories {
google()
gradlePluginPortal()
}
}
rootProject.name='exampleProject'
include ':app' -
In your module (app-level) Gradle file (usually
app/build.gradle
), apply the Google Services Gradle plugingoogle-services
and declare the version:plugins {
id 'com.google.gms.google-services' version '4.3.13'
}Note: If you have already introduced the
google-services
plugin using plugins DSL in thepluginManagement {}
block insettings.gradle
and declared the version, you can directly apply the plugin in the module (app-level)app/build.gradle
file without declaring the version again:plugins {
id 'com.google.gms.google-services'
}
-
-
Step 4: Add the Firebase SDK to Your Android App
- In the module (app-level) Gradle file (usually
app/build.gradle
), declare dependencies and enable FCM push.
android {
defaultConfig {
//...
manifestPlaceholders = [
FCM_PUSH_ENABLE : "true"
]
}
}
dependencies {
// x.y.z is the current IM SDK version number
implementation 'cn.rongcloud.sdk.push:fcm:x.y.z'
}
For more details, refer to the Firebase Chinese Documentation Set Up a Firebase Cloud Messaging Client App (Android).
At this point, you have successfully integrated Firebase into your Android project.
Please proceed to the next steps to Authorize FCM Requests in the Console.
Authorize FCM Requests in the Console
Requests sent from RC to FCM must be authorized. Therefore, you need to provide RC with the service account credentials related to your FCM project. You need to manually upload this credential to the console.
Step 1: Obtain Google Service Account Credentials
Firebase projects support Google service accounts. You need to obtain credentials from your Google service account and authorize RC servers to use these account credentials to call Firebase server APIs.
To authenticate the service account and grant it access to Firebase services, you must generate a private key file in JSON format. To generate a JSON private key file for your service account, follow these steps:
- In the Firebase Console, open Settings > Service Accounts.
- Click Generate New Private Key, then click Generate Key to confirm.
- Securely store the JSON file containing the key. You will need to upload this file to the RC Console later.
Step 2: Upload FCM Credentials to the Console
Go to the RC Console, and in the Application Identifier > Android > Google (FCM) tab, fill in the credentials obtained in the previous step.
-
Select Authentication Method:
-
Certificate (recommended): Upload the private key JSON file generated from your service account.
-
API Key (using the legacy Server Key authorization method and legacy FCM API): Enter the server key obtained from your service account.
Warning
If the authentication method configured in your project is API Key, please note that as of June 20, 2023, sending messages (including upstream messages) using the legacy FCM XMPP and HTTP APIs has been deprecated by FCM and will be removed by June 2024. RC's push service backend will also remove this capability by then. Therefore, you need to migrate to the certificate (FCM's JSON private key file) authentication method as soon as possible. For detailed instructions, refer to the above Obtain Google Service Account Credentials.
-
-
Push Method (see Firebase Chinese Documentation FCM Message Types):
- Data Message Method: The Android OS directly displays the notification in the notification panel. RC only sends data corresponding to the FCM "data message" type.
- Notification Message Method: The IMLib SDK receives the data message, parses it, and displays the notification. Developers can also customize the handling. RC sends data containing both FCM "data message" and "notification message".
-
Intent: Customize the operation associated with the notification click, corresponding to the FCM
click_action
field. If specified, when the user clicks the notification, the Activity matching this Intent will be launched by default. It is recommended to use your app's package name as a prefix to ensure uniqueness.For example, specify the Intent in the console as:
com.yourapp.demo.ExampleActivity
In your app's
AndroidManifest.xml
, you need to specify the Activity that can match this Intent.<activity android: name = ".ExampleActivity">
<intent-filter>
<action android: name = "com.yourapp.demo.ExampleActivity" />
...
</intent-filter>
</activity> -
Priority (see Firebase Chinese Documentation Set Message Priority):
- Normal: Normal priority messages are delivered immediately when the app is in the foreground. When the app is in the background, message delivery may be delayed. For messages that are not time-sensitive (e.g., new email notifications, keeping the UI in sync, or syncing app data in the background), it is recommended to choose normal delivery priority.
- High: FCM will attempt to deliver high-priority messages immediately, even if the device is in Doze mode. High-priority messages are suitable for time-sensitive, user-visible content.
-
Push Notification Title: When calling the server API interfaces
/push.json
,/push/user.json
,/push/custom.json
to send push notifications, if the notification title is not passed in, the "Push Notification Title" set below will be used. When sending messages from the server, if the sender's user ID does not have a username in the RC server, this "Push Notification Title" will also be used. Generally, this title is not displayed when messages are sent from the client and converted to Push. -
Push Channel Type: For GCM push, RC uses the default push channel by default. If you need to use a private push channel, select the private channel and set the Channel ID.
Enable FCM Push Service on the Client
-
Before initializing the SDK, initialize the
RongPushPlugin
module.RongPushPlugin.init(getContext());
If the
RongPushPlugin
module is not found, check if you have Integrated RC's Self-Built Push Channel. -
(Optional) After enabling FCM push, if you need to re-enable Analytics data collection, call the
setAnalyticsCollectionEnabled()
method of theFirebaseAnalytics
class. For example:setAnalyticsCollectionEnabled(true);
If you do not need to receive push notifications, you can set the enablePush
parameter in the SDK initialization configuration to false
to request the RC service to disable the push service (for the current device). You can also set not to receive push notifications when disconnecting (for the current device).
Test FCM Push Notifications
After completing the above steps, you can directly test whether the push notification integration is successful.
Device Conditions
It is recommended to use Android devices officially sold overseas to test the reception of FCM push notifications. The detailed requirements for the test device are as follows:
- The test device must be a physical device. Emulators cannot receive remote push notifications.
- The test device must support Google GMS services (Google Mobile Services). You can directly use Android devices officially sold overseas. Note that devices sold in mainland China generally do not come with GMS services pre-installed. Some brands of devices cannot install GMS services on their own due to lack of authorization.
Network Conditions
It is recommended to test in a simulated overseas network environment. The detailed conditions are as follows:
- If testing in mainland China, the test device must use a foreign IP address to establish an IM connection with RC and access RC services using an overseas IP. If a domestic IP is used, the RC server will consider the device to be in China and will not enable the FCM channel.
- The network environment of the test device must be able to access Google network services normally. Otherwise, even if FCM push is triggered, the device will not be able to receive push notifications from Google's FCM service.
Test Steps
Assume testing in the development environment. The app uses the development environment App Key.
The specific steps are as follows:
- After the app successfully connects to RC, kill the app process.
- Visit the IM Server API Debugging page in the console, switch to the app's development environment, find Messages > Message Service > Send One-to-One Message, and directly send a one-to-one message.
- Check if the phone receives a push notification from the app.
Troubleshooting
- If the app used for testing belongs to RC's overseas data center (North America or Singapore), check if you have executed
setServerInfo
to set the navigation domain for the overseas data center before initializing the SDK. For details, see Overseas Data Centers. - Send a message directly from the Google FCM service backend to the device. If it is not received, first check if the integration is correct according to the above documentation.
- Check if the app has been restricted by the device as a background-restricted app. On Android P or higher, FCM will not send push notifications to apps that have been restricted by the user (e.g., via "Settings" -> "Apps & Notifications" -> "[appname]" -> "Battery" to restrict background activity). For details, see the Android Developer Documentation Background-Restricted Apps.
- Do not frequently send the same content message to the same phone, as it may be blocked by the FCM server, resulting in no push notification being received.
- Check if the test device is a ROM for domestic phones. Some brands no longer support installing GMS services on their own. It is recommended to replace it with a device sold overseas or update the test device's system.
If the issue cannot be resolved, you can Submit a Ticket and provide your message ID.
Obfuscation Script
-keep public class com.google.firebase.* {*;}
Handle Push Notification Click Events
- Custom Push Notification Click Event: Implement SDK's default jump behavior or customize click handling. See Custom Push Notification Click Event.
- Custom Push Notification Style: Only supported when the console's FCM push method is Data Message Method. See Custom Push Notification Style.
Gradle Plugin Portal: https://plugins.gradle.org/ --- title: Integrate FCM Push
- FCM push channel is suitable for Android devices officially sold overseas (with built-in Google GMS services) and will be enabled in overseas network environments.
- After integration, it is recommended to test according to the conditions and steps described in Testing FCM Push.
RC's server has integrated components for communicating with the FCM backend. When the App running on the recipient's device is killed, suspended in the background, or remains in the background for more than 2 minutes, the IM SDK's long connection channel will be disconnected. At this time, if there are messages to be delivered, the RC server will send a message request to the FCM backend, which will then send the message to the client application running on the user's device.
Integrate FCM into Android Project
This section describes how to add Firebase to your Android project through the Firebase Console following Google's recommended setup workflow. During this process, you must manually add plugins and configuration files to your project.
To help you quickly get started, the steps have been simplified. For detailed steps, you can refer to Google Documentation or Firebase Chinese Documentation.
Prerequisites
- Install the latest version of Android Studio or update it to the latest version.
- Ensure your project meets the following requirements:
- (SDK ≧ 5.6.3) Use Android 5.0 (API 21) or higher;
- (SDK < 5.6.3) Use Android 4.4 (API 19) or higher;
- Use Jetpack (AndroidX), which requires the following versions:
com.android.tools.build:gradle 3.2.1
or highercompileSdkVersion 28
or higher
- Set up a physical device or use an Emulator to run your app. Note that the FCM client belongs to the Firebase SDK Dependent on Google Play Services and requires Google Play Services to be installed on the device or emulator.
- Log in to Firebase with your Google account.
To add Firebase to your app, you need to perform several tasks in the Firebase Console and the opened Android project (e.g., download the Firebase configuration file from the console and move the configuration file to the Android project).
Step 1: Create a Firebase Project
-
In the Firebase Console, click Add Project.
- To create a new project, enter the project name you want to use. You can also modify the project ID displayed below the project name as needed.
- To add Firebase resources to an existing Google Cloud project, enter the project name or select it from the dropdown menu.
-
Click Continue. Finally, click Create Project (or Add Firebase if using an existing Google Cloud project).
Firebase will automatically provision resources for your Firebase project. After this process is completed, you will be taken to the overview page of the Firebase project in the Firebase console.
A Firebase project is essentially a Google Cloud project with additional Firebase-specific configurations and services enabled. When you create a new Firebase project, you are actually creating a Google Cloud project behind the scenes. For details, refer to the Firebase Chinese Documentation Relationship Between Firebase Projects and Google Cloud.
Step 2: Register Your Android App in Firebase
To use Firebase in your Android app, you need to register your app with the Firebase project. The process of registering an app is often referred to as "adding" the app to the project.
-
Go to the Firebase Console.
-
In the center of the project overview page, click the Android icon or add an app to start the setup workflow.
-
In the Android Package Name field, enter your app's package name.
- The Package Name is the unique identifier for your app on the device and in the Google Play Store.
- The package name is often referred to as the app ID.
- Find your app's package name in the module (app-level) Gradle file (usually app/build.gradle) (example package name: com.yourcompany.yourproject).
- Note that the package name value is case-sensitive, and once you register this Firebase Android app in the Firebase project, you cannot change its package name.
-
Complete other optional configurations as needed. Then click Register App.
Step 3: Add Firebase Configuration File to Android Studio Project
This step describes how to add the Firebase Android configuration file to your app.
-
After registering the app, click Download google-services.json to get the Firebase Android configuration file (
google-services.json
). -
Move the configuration file to the module (app-level) directory of your app.
- For more details about this configuration file, visit Understanding Firebase Projects.
- You can download the Firebase configuration file again at any time.
- Ensure that the configuration file name is not appended with additional characters, such as (2).
-
To enable Firebase products in your app, add the
google-services
plugin to the Gradle file.Note, all Firebase SDKs use the google-services Gradle plugin (
google-services
), but this plugin has nothing to do with Google Play Services.-
Method 1: Add the plugin using Gradle's
buildscript
block. Both Google Documentation and Firebase Chinese Documentation use this method.-
Modify the root-level (project-level) Gradle file (
build.gradle
), add rules in the buildscript block to import the Google Services Gradle plugin. Make sure you add Google's Maven repository.buildscript {
repositories {
// Check if this line exists (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following configuration:
classpath 'com.google.gms:google-services:4.3.13' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check if this line exists (if not, add it):
google() // Google's Maven repository
// ...
}
} -
In your module (app-level) Gradle file (usually
app/build.gradle
), apply the Google Services Gradle plugin:apply plugin: 'com.android.application'
// Add the following line:
apply plugin: 'com.google.gms.google-services' // Google Services plugin
android {
// ...
}
-
-
Method 2: Use Gradle's plugins DSL. If you are familiar with Gradle's plugins DSL syntax and already use it in your project, you can use this method.
-
By default, plugins DSL only supports core plugins published in the Gradle Plugin Portal. Since the
google-services
plugin is not in this repository, you need to add Google's plugin repository address first.Declare Google's Maven repository in the root-level (project-level) Gradle settings file (
settings.gradle
).pluginManagement {
// (Optional) Introduce the google-services plugin and declare the version when declaring the repository
//plugins {
// id 'com.google.gms.google-services' version '4.3.13'
//}
repositories {
google()
gradlePluginPortal()
}
}
rootProject.name='exampleProject'
include ':app' -
In your module (app-level) Gradle file (usually
app/build.gradle
), apply the Google Services Gradle plugingoogle-services
plugin and declare the version:plugins {
id 'com.google.gms.google-services' version '4.3.13'
}Note: If you have already introduced the
google-services
plugin using plugins DSL in thepluginManagement {}
block ofsettings.gradle
and declared the version, you can directly apply the plugin in the module (app-level)app/build.gradle
file without declaring the version again:plugins {
id 'com.google.gms.google-services'
}
-
-
Step 4: Add Firebase SDK to Your Android App
- Declare dependencies in the module (app-level) Gradle file (usually
app/build.gradle
) and enable FCM push.
android {
defaultConfig {
//...
manifestPlaceholders = [
FCM_PUSH_ENABLE : "true"
]
}
}
dependencies {
// x.y.z is the current IM SDK version number
implementation 'cn.rongcloud.sdk.push:fcm:x.y.z'
}
For more details, refer to the Firebase Chinese Documentation Set Up a Firebase Cloud Messaging Client App (Android).
At this point, you have successfully integrated Firebase into your Android project.
Continue with the following steps to Authorize FCM Requests in the Console.
Authorize FCM Requests in the Console
Requests sent from RC to FCM must be authorized. Therefore, you need to provide RC with the service account authorization credentials related to the FCM project. You need to manually upload this credential to the console.
Step 1: Get Google Service Account Credentials
Firebase projects support Google Service Accounts. You need to get credentials from your Google service account and authorize RC servers to call Firebase server APIs with these account credentials.
To authenticate the service account and grant it access to Firebase services, you must generate a private key file in JSON format. To generate a private key file in JSON format for your service account, follow these steps:
- In the Firebase console, open Settings > Service Accounts.
- Click Generate New Private Key, then click Generate Key to confirm.
- Store the JSON file containing the key securely. You will need to upload this file to the RC console later.
Step 2: Upload FCM Credentials to the Console
Go to the RC console, and in the App Identifier > Android > Google (FCM) tab, fill in the credentials obtained in the previous step.
-
Select Authentication Method:
-
Certificate (Recommended): Upload the private key JSON file generated from your service account.
-
API Key (Use the legacy Server Key authorization method and legacy FCM API): Enter the server key obtained from your service account.
Warning
If the authentication method configured in your project is API Key, note that as of June 20, 2023, sending messages (including upstream messages) using the FCM XMPP and HTTP legacy APIs has been deprecated by FCM and will be removed in June 2024. RC's push service backend will also remove this capability at that time. Therefore, you need to migrate to the certificate (FCM's JSON format private key file) authentication method as soon as possible. For detailed methods, refer to the above Get Google Service Account Credentials.
-
-
Push Method (see Firebase Chinese Documentation FCM Message Types for details):
- Transparent Message Method: The Android OS directly pops up notifications in the notification panel. RC only delivers data corresponding to the FCM "data message" type.
- Notification Message Method: After the IMLib SDK receives the transparent data, it parses the data and pops up notifications. Developers can also customize the handling. RC delivers data containing both FCM "data message" and "notification message".
-
Intent: Customize the operation associated with the user clicking the notification, corresponding to the
click_action
field of FCM. If specified, when the user clicks the notification, the Activity matching this Intent will be launched by default. It is best to use the app's package name as a prefix to ensure uniqueness.For example, specify the Intent in the console as:
com.yourapp.demo.ExampleActivity
In your App's
AndroidManifest.xml
, you need to specify the Activity that can match this Intent.<activity android: name = ".ExampleActivity">
<intent-filter>
<action android: name = "com.yourapp.demo.ExampleActivity" />
...
</intent-filter>
</activity> -
Priority (see Firebase Chinese Documentation Set the Priority of a Message for details)
- Normal: When the app is running in the foreground, normal priority messages are delivered immediately. When the app is running in the background, message delivery may be delayed. For messages that are not time-sensitive (e.g., new email notifications, keeping the UI in sync, or syncing app data in the background), it is recommended to choose normal delivery priority.
- High: Even if the device is in low-power mode, FCM will immediately attempt to deliver high-priority messages. High-priority messages are suitable for time-sensitive user-visible content.
-
Push Notification Title: When calling the server API interfaces
/push.json
,/push/user.json
,/push/custom.json
to push notifications, if the notification bar title is not passed, the "Push Notification Title" set below will be used. When sending messages from the server, if the sender's user ID does not have a username on the RC server, this "Push Notification Title" will also be used. Generally, this title is not displayed when messages sent by the client are converted to push notifications. -
Push Channel Type: RC uses the Default push channel for GCM push by default. If you need to use a Private push channel, you can select the private channel and set the Channel ID.
Enable FCM Push Service on the Client
-
Initialize the
RongPushPlugin
module before SDK initialization.RongPushPlugin.init(getContext());
If the
RongPushPlugin
module cannot be found, check if the RC Self-built Push Channel has been integrated. -
(Optional) After enabling FCM push, if you need to re-enable Analytics data collection, call the
setAnalyticsCollectionEnabled()
method of theFirebaseAnalytics
class. For example:setAnalyticsCollectionEnabled(true);
If you do not need to receive push notifications, you can set the enablePush
parameter in the SDK initialization configuration to false
to request RC to disable the push service for the current device. You can also set not to receive push notifications when disconnecting (for the current device).
Test FCM Push
After completing the above steps, you can directly test whether the push integration is successful.
Device Requirements
It is recommended to use Android devices officially sold overseas to test the reception of FCM push notifications. The detailed requirements for test devices are as follows:
- Test devices must use real devices. Emulators cannot receive remote push notifications.
- Test devices must support Google GMS services (Google Mobile Services). You can directly use Android devices officially sold overseas. Note that devices sold in mainland China generally do not come pre-installed with GMS services. Some brands of devices cannot install GMS services on their own due to lack of authorization.
Network Requirements
It is recommended to test in a simulated overseas network environment. The detailed conditions are as follows:
- If testing in mainland China, the test device must use a foreign IP address to establish an IM connection with RC and access RC services using an overseas IP. If a domestic IP is used, the RC server will consider the device to be in China and will not enable the FCM channel.
- The network environment of the test device must be able to access Google network services normally. Otherwise, even if FCM push is triggered, the device will not be able to receive push notifications from Google's FCM service.
Test Steps
Assume testing in a development environment. The App uses the test environment App Key.
The specific steps are as follows:
- After the APP successfully connects to RC, kill the APP process.
- Visit the IM Server API Debug page in the console, switch to the App's development environment, find Messages > Message Services > Send Private Message, and directly send a private message.
- Check if the phone receives a push notification from this APP.
Troubleshooting
- If the App used for testing belongs to RC's overseas data center (North America or Singapore), check if the
setServerInfo
method has been executed before SDK initialization to set the navigation domain for the overseas data center. See Overseas Data Center for details. - Send a message directly from the Google FCM service backend to the device. If not received, first check if the integration is correct according to the above documentation.
- Check if the App is set as a background-restricted app on the device. On Android P or higher, FCM will not send push notifications to apps that have been background-restricted by the user (e.g., through "Settings" -> "Apps & Notifications" -> "[appname]" -> "Battery" to implement background restrictions). See the Android developer documentation Background-Restricted Apps for details.
- Do not frequently send the same content message to the same phone, as it may be blocked by the FCM server and fail to receive push notifications.
- Check if the test device is a ROM for domestic phones. Some brands no longer support self-installation of GMS services. It is recommended to replace it with a device sold overseas or update the system of the test device.
If the issue cannot be resolved, you can submit a ticket and provide your message ID.
Obfuscation Script
-keep public class com.google.firebase.* {*;}
Handle Push Notification Click Events
- Custom Push Notification Click Events: Introduces how to implement the SDK's default jump behavior and how to customize the handling of click events. See Custom Push Notification Click Events for details.
- Custom Push Notification Styles: Only supported when the FCM message push method in the console is Transparent Message Method. See Custom Push Notification Styles for details.