-
public final class InAppPushPrimerPush Primer — soft-ask in-app card shown BEFORE Android 13+'s runtime POST_NOTIFICATIONS prompt.
Mirror of iOS InAppPushPrimer. Industry data: pre-permission soft-ask boosts opt-in from ~30% to ~60%.
Android pre-13: notifications are granted by default unless the user disables them in settings. The primer still applies — operators use it to re-engage users who toggled notifications off after install.
Android 13+: runtime POST_NOTIFICATIONS permission required. Primer shows BEFORE the runtime prompt; only Allow-tappers see the system prompt, preserving the one-shot opportunity.
Render type identifier:
"push_primer". Pinned bylibs/mobile-sdk/ios-sdk/Tests/drift/inapp-render-contract.json(shared cross-SDK contract).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classInAppPushPrimer.Companionpublic final classInAppPushPrimer.Config
-
Method Summary
Modifier and Type Method Description final BooleanisInCooldown(Long nowMillis, Integer cooldownDays)True when user previously tapped "Not right now" and the cooldown window hasn't elapsed. final UnitclearCooldown()final BooleanisAlreadyAuthorized()True if POST_NOTIFICATIONS is already granted (Android 13+) or the device is < Android 13 (no runtime permission needed). final Unitdisplayed(InAppPushPrimer.Config config)final UnitallowTapped(Activity activity, InAppPushPrimer.Config config)User tapped "Allow" — fires the runtime POST_NOTIFICATIONS prompt on Android 13+. final UnitonPermissionResult(InAppPushPrimer.Config config, IntArray grantResults)Routes the system permission outcome back to the SDK. final UnitlaterTapped(InAppPushPrimer.Config config)final Unitdismissed(InAppPushPrimer.Config config)-
-
Method Detail
-
isInCooldown
final Boolean isInCooldown(Long nowMillis, Integer cooldownDays)
True when user previously tapped "Not right now" and the cooldown window hasn't elapsed. SDK should skip show while true.
-
clearCooldown
final Unit clearCooldown()
-
isAlreadyAuthorized
final Boolean isAlreadyAuthorized()
True if POST_NOTIFICATIONS is already granted (Android 13+) or the device is < Android 13 (no runtime permission needed).
-
displayed
final Unit displayed(InAppPushPrimer.Config config)
-
allowTapped
final Unit allowTapped(Activity activity, InAppPushPrimer.Config config)
User tapped "Allow" — fires the runtime POST_NOTIFICATIONS prompt on Android 13+. On pre-13 we treat the soft-ask as the system permission (notifications are default-on) and emit
push_primer.permission_grantedimmediately.The operator's Activity.onRequestPermissionsResult callback must route the outcome back via onPermissionResult.
-
onPermissionResult
final Unit onPermissionResult(InAppPushPrimer.Config config, IntArray grantResults)
Routes the system permission outcome back to the SDK. Call from the host Activity's
onRequestPermissionsResultwhen the requestCode matches POST_NOTIFICATIONS_REQUEST_CODE.
-
laterTapped
final Unit laterTapped(InAppPushPrimer.Config config)
-
dismissed
final Unit dismissed(InAppPushPrimer.Config config)
-
-
-
-