FCM dependency:
Before you can start receiving push notifications, you need to obtain a FCM unique token string that identifies each FCM client app instance:
You can initialize the services with the obtained token. Please note that the FCM token can be changed through application life cycle. Please make sure that the FCM token supplied to the messaging SDK is up to date. To notify the messaging SDK of the latest token, the following line of code can be called whenever necessary:
To retrieve push notifications, use a service that extends FirebaseMessagingService
. Refer to Firebase's messages handling documentation for the detailed information.
Since Google play services are banned in China, The messaging SDK provides Baidu push services as a substitute for FCM. The messaging SDK requires an api key and a secret key from Baidu:
Baidu dependency:
Note: Baidu push services require number of additional permissions. You can find a list of permissions here.
Baidu API key is needed for Baidu push services initialization:
Note: The messaging SDK always consider FCM as a primary push provider and Baidu as a secondary push provider. If the messaging SDK detects Google play services on the device, Baidu push services won't be initialized.