Skip to content

Feat/access local network 9 - #8624

Open
fabiomartino wants to merge 2 commits into
ionic-team:nextfrom
fabiomartino:feat/ACCESS_LOCAL_NETWORK-9
Open

fabiomartino wants to merge 2 commits into
ionic-team:nextfrom
fabiomartino:feat/ACCESS_LOCAL_NETWORK-9

Conversation

@fabiomartino

Copy link
Copy Markdown

Android 16 (API 37) blocks local-network addresses by default and introduces
ACCESS_LOCAL_NETWORK as a runtime permission. Without framework support,
apps using CapacitorHttp against LAN devices fail with timeouts on API 37+.

This change:

  • declares android.permission.ACCESS_LOCAL_NETWORK in the core library
    manifest (merged into every app, safely ignored on older SDKs);
  • adds a version-aware PermissionHelper gate (isPermissionEnforced, with
    string literal + literal API 37 constant so the compile SDK can stay
    below 37);
  • reports the permission as GRANTED on SDKs below 37 and only runs the
    manifest check / DENIED caching on enforced SDKs, in both
    Bridge.validatePermissions() and Bridge.getPermissionStates();
  • adds a first-party LocalNetwork plugin exposing the standard
    checkPermissions()/requestPermissions() flow from JavaScript, with no
    app-side native code required.

Adds unit tests covering the API 37 boundary in PermissionHelper, the
Bridge permission state/validation behavior, and the LocalNetwork plugin
registration and pre-37 granted flow.

Closes #8613

This branch has not been deployed

No deployments
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.

1 participant