— bash — netgod.dev — 80×24
guest@netgod.dev:~/blog$ cat android-15-predictive-back-gesture.md
← cd ../blog
POST(ANDROID)netgod.dev manualPOST(ANDROID)
NAME

$ Android 15 Predictive Back Gesture: What Actually Changed

DESCRIPTION

The predictive back animation is finally on by default. Here's what breaks in your app and how to opt in properly with Compose.

DATE
2025-04-03
DURATION
1 min read
TAGS
./assets/android-15-predictive-back-gesture.pngcover
CONTENT

The predictive back gesture has been in Android since 13 as a developer option. In 15 it's the default, and any app targeting SDK 35+ that still relies on the legacy OnBackPressedCallback flow will look broken.

The new contract

You no longer just handle back; you progressively respond to it. The user can drag, see your screen begin to slide away, and decide to release or cancel.

In Compose

PredictiveBackHandler(enabled = canGoBack) { progress ->
    progress.collect { event ->
        offsetX = event.progress * screenWidth
    }
    // commit
    navController.popBackStack()
}

The progress flow gives you 0..1 of the gesture. Do whatever animation you want — match the system one for consistency, or differentiate.

What breaks

  • Custom navigation libs that swallow back without forwarding it
  • Modal sheets that animate themselves and the underlying screen
  • Any place you assumed back is instantaneous

What I do now

Write a BackGestureScaffold once per project, route everything through it, ban direct OnBackPressedDispatcher access. The discipline pays off every release.

netgod.dev manual2025-04-03END