GoogleChrome / GoogleChrome/android-browser-helper
Detection and Prevention of App Opening in Desktop Mode in Trusted Web Activity
- Dominant language
- Java
- Stars
- 832
- Forks
- 370
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 6
Description
### **Is your feature request related to a problem? Please describe.**
Currently, there is no direct way to detect and prevent a Trusted Web Activity (TWA) from opening in "Desktop Mode" when the user selects this mode in Chrome settings on a mobile device. This can lead to an undesirable user experience, as the app is optimized for mobile and may not function correctly in desktop mode.
**The problem:**
We need a mechanism to identify when Chrome is in "Desktop Mode" on mobile devices and either switch back to "Mobile Mode" automatically or show the user a message prompting them to return to mobile mode.
### **Describe the solution you'd like**
I would like to see a feature in the TWA library that provides:
- **Detection:** A built-in API or callback in the Trusted Web Activity that can detect when the app is being opened in "Desktop Mode."
- **Prevention:** An option to prevent the TWA from launching in desktop mode and instead show a customizable message to the user prompting them to switch back to "Mobile Mode."
- **Automatic handling:** An automatic fallback to "Mobile Mode" where possible without user intervention.
Contributor guide
Assessment
This issue has not been assessed yet.