- Configure the Android app and provider, such as Firebase Cloud Messaging.
- Connect the provider token and signed-in device to social.plus through the SDK.
SDK Surface
Parameters
1. Configure FCM
Follow the Android and Firebase setup flow for your app:- Add
google-services.jsonto your app module. - Apply the Google Services Gradle plugin.
- Add Firebase Messaging using the version recommended for your Firebase setup.
- Request
POST_NOTIFICATIONSat runtime on Android 13+ when your product needs visible notifications.
Gradle
Use the same
x.y.z version you use for co.amity.android:amity-sdk. If your package already bundles the FCM adapter, do not add a duplicate dependency.2. Upload Provider Credentials
In the social.plus Console, open Settings > Push Notifications and upload the Firebase service account JSON for your app. Without this server-side credential, client registration can succeed while push delivery still fails.3. Connect the FCM Token
Pass every current FCM token to the SDK push adapter. Do this for the initial token and every token refresh.FirebaseMessagingService.onNewToken(token).
4. Register the Signed-In Device
After the SDK has a signed-in user session and the app has connected the FCM token, register the current device/user with social.plus.registerPushNotification() has no token parameter in the current Android SDK. The token is handled by the push adapter through AmityFcm.create().setup(fcmToken).Optional Baidu Adapter
The Android source also contains an optional Baidu push adapter,AmityBaidu.create(context).setup(baiduApiKey), for builds that include the Baidu push module. The default Android SDK build path uses the FCM adapter, so treat Baidu setup as a China-market build decision and verify the module distribution before enabling it.
Setup Checklist
- FCM is configured in the Android app.
- The Firebase service account JSON is uploaded in the social.plus Console.
- The latest FCM token is passed to
AmityFcm.create().setup(fcmToken). - The signed-in device/user is registered with
AmityCoreClient.registerPushNotification(). - The device is unregistered on sign-out when the app should stop receiving push notifications for that user.