Skip to content

Fix Linking.openSettings() rejecting on Android when there is no current activity - #59567

Open
Nezz wants to merge 1 commit into
react:mainfrom
Nezz:fix-open-settings-without-activity
Open

Nezz wants to merge 1 commit into
react:mainfrom
Nezz:fix-open-settings-without-activity

Conversation

@Nezz

@Nezz Nezz commented Oct 28, 2026

Copy link
Copy Markdown

Summary:

On Android, Linking.openSettings() rejects with Could not open the Settings: Required value was null when the React context has no current activity, because openSettings wraps getCurrentActivity() in checkNotNull. This happens for some of our users, unclear why.

The settings intent already carries FLAG_ACTIVITY_NEW_TASK, so it can start from the application context. This change does that when there is no activity, the same fallback sendOSIntent (behind openURL and sendIntent) already has.

Changelog:

[ANDROID] [FIXED] - Linking.openSettings() no longer rejects when there is no current activity

Test Plan:

Added openSettings_withNullActivity_startsSettingsFromApplicationContext to IntentModuleTest. With no current activity, openSettings now starts the ACTION_APPLICATION_DETAILS_SETTINGS intent from the application context and resolves; before this change it rejected without starting anything.

…ent activity

openSettings wrapped getCurrentActivity() in checkNotNull, so it rejected with "Could not open the Settings: Required value was null" whenever the React context had no activity. The intent already carries FLAG_ACTIVITY_NEW_TASK, so start it from the application context then, as sendOSIntent does.
@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 Oct 28, 2026
@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 Oct 28, 2026

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

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. 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.

1 participant