Skip to content

Android: provide a way to enable cleartext HTTP #916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mhsmith opened this issue Oct 13, 2022 · 1 comment · Fixed by beeware/briefcase-android-gradle-template#53
Closed
Labels
android The issue relates to Android mobile support. enhancement New features, or improvements to existing features.

Comments

@mhsmith
Copy link
Member

mhsmith commented Oct 13, 2022

Is your feature request related to a problem? Please describe.

As mentioned at beeware/toga#1612, recent versions of Android disable unencrypted HTTP connections by default, even to localhost. This prevents writing apps which follow the server-and-WebView pattern.

This can be controlled using the following AndroidManifest settings:

Describe the solution you'd like

Initially, I suggest we update the template to always set usesCleartextTraffic="true", so users can run the Positron examples and write similar apps of their own.

Later, we could provide some configuration mechanism in pyproject.toml.

@mhsmith mhsmith added enhancement New features, or improvements to existing features. android The issue relates to Android mobile support. labels Oct 13, 2022
@freakboy3742
Copy link
Member

Given that it's needed for postitron-style examples, I'm inclined to agree that we should put a hard-coded workaround in place, and then tackle configurable permissions (#547) as a high-ish priority.

However, I'd suggest that adding a networkSecurityConfig approach would be better in this case. Opening up HTTP for all connections opens up apps to a small risk that users might not be expecting based on ambient Android documentation about HTTP usage; however, opening it up just for localhost is arguably what Android's default behavior should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android The issue relates to Android mobile support. enhancement New features, or improvements to existing features.
Projects
None yet
2 participants