diff --git a/sites/docs/src/content/platform-integration/android/predictive-back.md b/sites/docs/src/content/platform-integration/android/predictive-back.md index 11766c4fc9..7f1076e3ce 100644 --- a/sites/docs/src/content/platform-integration/android/predictive-back.md +++ b/sites/docs/src/content/platform-integration/android/predictive-back.md @@ -1,61 +1,49 @@ --- -title: Add the predictive-back gesture -shortTitle: Predictive-back +title: Add the predictive back gesture +shortTitle: Predictive back description: >- - Learn how to add the predictive back gesture to your Android app. + Learn how to support the predictive back gesture in your Android app. --- -This feature has landed in Flutter, -but it's not enabled by default in Android itself yet. -You can try it out using the following instructions. +Flutter supports the predictive back gesture on Android by default. +However, to opt in to the platform feature, +you must configure your Android app. ## Configure your app -Make sure your app supports Android API 33 or higher, -as predictive back won't work on older versions of Android. -Then, set the flag `android:enableOnBackInvokedCallback="true"` -in `android/app/src/main/AndroidManifest.xml`. +To support the predictive back gesture, +your app must target Android API level 33 (Android 13) or higher. -## Configure your device +To opt in, add the `android:enableOnBackInvokedCallback="true"` attribute +to the `` tag +in your `android/app/src/main/AndroidManifest.xml` file: -You need to enable Developer Mode and set a flag on your device, -so you can't yet expect predictive back to work on most users' -Android devices. If you want to try it out on your own device though, -make sure it's running API 33 or higher, and then in -**Settings => System => Developer** options, -make sure the switch is enabled next to **Predictive back animations**. - -## Set up your app - -The predictive back route transitions are currently -not enabled by default, so for now you'll need to enable them -manually in your app. -Typically, you do this by setting them in your theme: - -```dart -MaterialApp( - theme: ThemeData( - pageTransitionsTheme: const PageTransitionsTheme( - builders: { - // Set the predictive back transitions for Android. - TargetPlatform.android: PredictiveBackPageTransitionsBuilder(), - }, - ), - ), - ... -), +```xml + + ``` -## Run your app +## Configure your device -Lastly, just make sure you're using at least -Flutter version 3.22.2 to run your app, -which is the latest stable release at the time of this writing. +Depending on the Android version of your test device, +you might need to enable the gesture in the system settings: + +* **Android 13 (API level 33):** + Enable **Predictive back animations** under + **Settings** > **System** > **Developer options**. +* **Android 14 (API level 34) and higher:** + The gesture and its animations are enabled by default. + +## Run your app -## For more information +To run your app with predictive back support, +use Flutter 3.38 or higher. -You can find more information at the following link: +## See also -* [Android predictive back][] breaking change +For details, +see [Android predictive back][]. [Android predictive back]: /release/breaking-changes/android-predictive-back