Guides
WebView App Back Button Closes the App? Android 16 Predictive Back Explained
After a rebuild for Android 16, swiping back can close a website app instead of going to the previous page. Here is Google's rule, a two-minute test, who fixes it and the temporary opt-out, checked November 2026.
If your Android app built from a website closes when someone swipes back, instead of returning to the previous page, a likely cause is old back-button code. Google says that for apps targeting Android 16 (API level 36) and running on Android 16 or later, the system no longer calls onBackPressed or dispatches the back key event to the app. A WebView app that relied on them to go back one page then stops doing so. The fix is a small change in the app's native code, so it has to come from whoever builds your app, not from your website.
Why does the back button close my WebView app on Android 16?
Google's Android 16 behavior changes page, last updated October 28, 2026, says that for apps targeting API 36 and running on Android 16 or higher, the predictive back animations (back-to-home, cross-task and cross-activity) are on by default. In the same section it says onBackPressed is not called and the back key event is not dispatched anymore. Google's predictive back guide adds that the back key itself is not deprecated, but intercepting back events through it is no longer supported.
A WebView app uses that interception for one job: go back a page if the web view has history, otherwise leave the app. A developer write-up published on November 20, 2026 names a wrapper that overrode onBackPressed to call goBack() as the classic victim, and says back then exits the app instead of going back one page. That is a third-party description, not a Google statement, but it follows directly from Google's rule. All sources were checked on November 25, 2026.
Which apps are affected, and which are not?
| Situation | Affected? | Why |
|---|---|---|
| Targets API 36, runs on Android 16 or later, back handled with onBackPressed or the back key event | Yes | Google says those calls no longer reach the app. |
| Targets API 36, back handled with OnBackPressedCallback | No | Google says OnBackPressedCallback is always called, whatever the opt-out flag says. |
| Targets API 35 or lower | Not by this rule | Google's change is listed for apps targeting API 36 or higher. |
| App targets API 36 but runs on Android 15 or older | Unclear | Google's page describes Android 16 or later devices only. Test it anyway. |
| App never handled back at all | Different bug | Our reading: back always left the app. The app needs a back callback tied to web history. |
The targeting part matters because Google Play now requires new apps and updates to target API 36, as we explain in Google Play's target API level requirement. That means an app that behaved well last year can start misbehaving after a rebuild, even though your website did not change. It is the same targeting step that brings portrait locks being ignored on tablets and the edge-to-edge layout described in content behind the status bar, so test all three together.
How do I test the back button before my users find the bug?
- 1
Use a real Android 16 phone
An emulator works too, but a phone shows what users see. Install the build you plan to publish, not a debug build.
- 2
Go three pages deep
Open the app, tap a link, then another, then a third. Note the page titles so you can tell where back lands.
- 3
Swipe back once
Expected: you land on the second page. If the app closes or jumps to the home screen, the app is not handling back for API 36.
- 4
Repeat with the back button
If your phone is set to gesture navigation, switch to three-button navigation and repeat. Both should behave the same.
- 5
Swipe back on the first page
Expected: the app leaves with the system animation. If you see no animation, a callback may be enabled when it should not be.
- 6
Try a half-filled form
Type into a form, go back, then forward. Google's own WebView codelab describes users losing unsubmitted survey answers when back goes to the wrong screen.
| Symptom | Likely cause | Who acts |
|---|---|---|
| App closes on the first back from a deep page | Back interception was not migrated for API 36 | App builder or developer |
| Back works, but the first-page exit has no animation | A back callback is always enabled | App builder or developer |
| Works on an older phone, fails on Android 16 | The targeting change described above | App builder or developer |
| Back goes to the previous page, but the form is empty | The page reloads on return, which is website behavior | Website owner. Repeat the same steps in Chrome to confirm. |
What does the correct fix look like inside the app?
Google's guidance is to move back handling to the AndroidX OnBackPressedDispatcher with an OnBackPressedCallback, using AndroidX Activity 1.6.0 or higher, and to stop intercepting onBackPressed and the back key event. For a WebView, Google's handling back navigation codelab shows the pattern: enable the callback while the web view can go back, and disable it when there are no more pages. The enabled state is refreshed from the web view client's doUpdateVisitedHistory method, which runs whenever the page history changes.
The disabling step matters. Google says that when an app enables a callback with default priority, the predictive back animations do not run and the app must handle the back event itself. A callback that is always enabled therefore blocks the back-to-home animation on the first page, which is the second row of the test above. In plain terms, the callback should only be on when there is a page to go back to.
If you did not write the app, you cannot apply this yourself. Ask your builder one question: does the current build handle back with an OnBackPressedCallback tied to web history, on a build that targets API 36? A clear yes or no is more useful than a promise to look into it.
Can I opt out of predictive back as a stopgap?
Google documents a manifest attribute, android:enableOnBackInvokedCallback, that can be set to false on the application tag or on a single activity. Its Android 16 page presents this as a temporary opt-out for apps that intercept back and have not migrated yet. Google's predictive back guide says that setting it to false turns off the system animation and makes the system ignore OnBackInvokedCallback, while OnBackPressedCallback calls keep working.
We found no end date for the opt-out. Google's Android 17 page for apps targeting API 37, updated November 11, 2026, does not mention back navigation, and the predictive back guide only says users might see unexpected behavior in a future release if apps do not migrate. Treat the flag as a way to buy time for a proper fix, not as the fix.
Frequently asked questions
- Why does my WebView app close when I press back on Android 16?
- For apps targeting Android 16 (API level 36) and running on Android 16 or later, Google says onBackPressed is not called and the back key event is not dispatched. If your app used them to go back a page in the web view, back now leaves the app instead. The app's code needs a back callback tied to web history.
- Does the back button change affect apps that target API 35?
- Google lists the change for apps targeting API 36 or higher, so an app that still targets API 35 is not covered by this rule. Google Play requires new apps and updates to target API 36, so a rebuilt app will be.
- Is android:enableOnBackInvokedCallback="false" a permanent fix?
- No. Google's Android 16 page calls it a temporary opt-out. It turns off the predictive back animation, and it does not replace migrating the back handling to OnBackPressedCallback.
- Can I fix the back button from my website?
- In our reading, not directly. The system back gesture is handled by the app's native code, so the fix has to ship as an app update. You can still check in Chrome that your pages behave sensibly when users go back, since the app can only return to pages that exist in history.
- How do I check which API level my app targets?
- In Play Console, open App bundle explorer for your app and look at the target SDK of each version. You can also upload a build to an internal testing track and see whether Play Console flags the target level.