Repository navigation
Conversation
…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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
On Android,
Linking.openSettings()rejects withCould not open the Settings: Required value was nullwhen the React context has no current activity, becauseopenSettingswrapsgetCurrentActivity()incheckNotNull. 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 fallbacksendOSIntent(behindopenURLandsendIntent) already has.Changelog:
[ANDROID] [FIXED] -
Linking.openSettings()no longer rejects when there is no current activityTest Plan:
Added
openSettings_withNullActivity_startsSettingsFromApplicationContexttoIntentModuleTest. With no current activity,openSettingsnow starts theACTION_APPLICATION_DETAILS_SETTINGSintent from the application context and resolves; before this change it rejected without starting anything.