Skip to content

Stop rotation from reloading the WebView (closes #14)#56

Open
jim-daf wants to merge 1 commit intowwWallet:mainfrom
jim-daf:fix/rotation-no-reload-issue-14
Open

Stop rotation from reloading the WebView (closes #14)#56
jim-daf wants to merge 1 commit intowwWallet:mainfrom
jim-daf:fix/rotation-no-reload-issue-14

Conversation

@jim-daf
Copy link
Copy Markdown

@jim-daf jim-daf commented Apr 23, 2026

Stop rotation from reloading the WebView

Closes #14

What changed

wrapper/src/main/AndroidManifest.xml

Add the orientation, screen size, and related configuration changes to the existing android:configChanges attribute on MainActivity. With these in place, Android no longer destroys and recreates the activity when the device rotates, so the hosted WebView keeps its document, its JavaScript state, and any signed-in user.

Key snippet

<activity
    android:name=".MainActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
    android:exported="true"
    android:theme="@style/Theme.Wwwallet">

Why these flags

  • orientation and screenSize are the pair Android requires to suppress activity recreation on rotation since API 13.
  • screenLayout and smallestScreenSize cover foldables and split-screen transitions.
  • uiMode covers system theme switches (day, night, car), which would otherwise also reset the WebView.

@jim-daf jim-daf marked this pull request as ready for review April 23, 2026 09:46
Copilot AI review requested due to automatic review settings April 23, 2026 09:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Android MainActivity manifest configuration to prevent activity recreation on device rotation (and related configuration changes), ensuring the embedded WebView keeps its document/JS/session state as reported in #14.

Changes:

  • Expand android:configChanges on MainActivity to include orientation and screen/UX-related configuration flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screen Rotation forces reload of webview

2 participants