Skip to content

Add local network permission prompt on android 17#57291

Open
alanjhughes wants to merge 4 commits into
mainfrom
alanhughes/android-37-local-network
Open

Add local network permission prompt on android 17#57291
alanjhughes wants to merge 4 commits into
mainfrom
alanhughes/android-37-local-network

Conversation

@alanjhughes

@alanjhughes alanjhughes commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary:

Android 17 (SDK 37) introduces Local Network Protection. Reaching any local-network address now requires the runtime ACCESS_LOCAL_NETWORK permission. This is how the dev server is reached, so on an Android 17 device the dev bundle download is blocked

This adds a debug-only path that requests ACCESS_LOCAL_NETWORK before the first bundle load and defers loadApp until the user answers, so a slow response can't cause an error

cc @zoontek

Changelog:

[Android] [Fixed] - Request ACCESS_LOCAL_NETWORK so the dev server stays reachable on Android 17 (SDK 37)[Android] [Added] - Add ACCESS_LOCAL_NETWORK to PermissionsAndroid

Test Plan:

Validated on an Android 17 emulator and physical device.

  • targetSdk 36 and 37
    launch → prompt appears → grant → bundle loads.
    Deny → app starts and shows the normal red-box connection error.
  • API 36 / older devices: no prompt, behavior unchanged.
  • USB device via adb reverse: no prompt (loopback is exempt).

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 19, 2026
@alanjhughes alanjhughes requested a review from cortinico June 19, 2026 15:49
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jun 19, 2026
@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

* that declares it, regardless of targetSdk.
*/
@JvmStatic
internal fun isAtLeastSdk37(): Boolean = Build.VERSION.SDK_INT >= VERSION_CODE_CINNAMON_BUN

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the permission can only be requested if targetSdkVersion is >= VERSION_CODE_CINNAMON_BUN too.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's required on any device running android 17 regardless of the target level

@meta-codesync

meta-codesync Bot commented Jun 19, 2026

Copy link
Copy Markdown

@fabriziocucci has imported this pull request. If you are a Meta employee, you can view this in D109160057.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants