Android push runs on Firebase Cloud Messaging (FCM). The pattern: add Firebase to your project, subclassDocumentation Index
Fetch the complete documentation index at: https://docs.spotzee.com/llms.txt
Use this file to discover all available pages before exploring further.
FirebaseMessagingService, hand the FCM token to Spotzee from onNewToken, then route incoming payloads through pushReceived so silent in-app refreshes work.
Prerequisites
- A push provider configured under Settings → Integrations with the FCM service-account JSON. Read Set up push notifications for the project-side setup.
- Firebase added to your Android project, with
google-services.jsonplaced underapp/. Follow Firebase’s Add Firebase to your Android project guide. - The
com.google.firebase:firebase-messagingdependency in your app module. - The Android Gradle plugin
com.google.gms.google-servicesapplied.
Manifest permissions
Add the standard Android push permissions:POST_NOTIFICATIONS is required for runtime notification permission on Android 13+.
Subclass FirebaseMessagingService
Spotzee plugs into the standard Firebase service. SubclassFirebaseMessagingService and:
- In
onNewToken, hand the FCM registration token toanalytics.register(...). - In
onMessageReceived, hand the data bundle toanalytics.pushReceived(bundle)so silent in-app pushes can trigger fetches.
AndroidManifest.xml:
How register works
analytics.register(token, appBuild, appVersion):
- Persists a per-install device UUID (created on first call) so the device is uniquely identifiable across app launches.
- Reports OS version, model, app version, and the FCM token to the user record.
- Picks up the persisted anonymous ID and the cached
externalId(when set) so the token is bound to the right user.
register without an identify first; the device is bound to the anonymous user and joined to the known user the first time you call identify.
If FCM registration fails or the user denies notification permission, you can still register the device’s characteristics by calling register with an empty token string. The user becomes addressable for non-push channels and segment rules.
Silent in-app refresh
A push withspotzee = true and check_in_app_messages = true in its data payload is a silent message that should trigger an in-app fetch, not a system notification. The SDK exposes a helper to detect them:
pushReceived(bundle) already triggers showLatestNotification for these silent pushes. You only need the helper to skip drawing your own system notification.
Test a push
Configure a test user under Settings → Integrations → Push and trigger a test send. Read Test a push for the project-side flow.What lives where
| Concern | Where |
|---|---|
| Provider credentials (FCM service-account JSON) | Settings → Integrations in the Spotzee app |
| FCM token registration | analytics.register(token, appBuild, appVersion) from onNewToken |
| Silent in-app refresh | analytics.pushReceived(bundle) + Spotzee.isCheckMessagePush(bundle) skip-guard |
| App Links from email taps | analytics.getUriRedirect(uri). Read In-app notifications and deeplinks |
Next steps
In-app notifications and deeplinks
Render in-app dialogs and unwrap App Links.
Configure push providers
Set up FCM credentials before the SDK can deliver push.