Android
Prerequisites: Android 7.0+ (API 24), Firebase in your app, an app in Settings → Apps with an Android client key, and an FCM service account. Read Concepts.
-
Add the dependencies.
app/build.gradle.kts implementation("com.mailpidge:lifecycle-sdk-core:1.0.0")implementation("com.mailpidge:lifecycle-sdk-notifications:1.0.0") -
Link a Google Cloud project to your app in Play Console and note its project number (without it:
403 attestation_required). -
Configure in your
Application.MailPidgeLifecycle.configure(context = this,clientCredential = "mpck_…",appId = "pidgefit-android",workerBaseUrl = "https://api.mailpidge.com",playIntegrityCloudProjectNumber = 123456789012L,) -
Register the FCM token. On Android 13+, request
POST_NOTIFICATIONSfirst.override fun onNewToken(token: String) {CoroutineScope(Dispatchers.IO).launch { MailPidgeLifecycle.registerPushToken(token) }} -
Identify after sign-in; reset on sign-out.
MailPidgeLifecycle.identify(externalUserId = user.id, identityToken = identityToken)MailPidgeLifecycle.reset() -
Track events and record consent.
MailPidgeLifecycle.track("workout_completed", mapOf("minutes" to 42))
Settings → Apps → your app → Send test push. The device shows as Active.