Pass flags when open an intent on Android
Summary:
This change introduces support for passing custom flags to Android Intents from React Native, which is critical for advanced navigation flows such as opening activities in a new task or clearing the back stack
Changelog:
[ANDROID] [ADDED] - Add flags parameter to sendIntent
Test Plan:
Open Android settings in the bluetooth page and then run the following method:
// Allow to open the location settings with a cleared activity
await Linking.sendIntent('android.settings.LOCATION_SOURCE_SETTINGS', [], [0X00008000])
It should open settings in the correct page
Hi @nicomontanari!
Thank you for your pull request and welcome to our community.
Action Required
In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.
Process
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!
Hi @cortinico, can you check this PR? We would like to have this feature directly into React Native without having to create additional custom module 🙏🏻
Can you elaborate on why this is needed?
This change introduces support for passing custom flags to Android Intents from React Native, which is critical for advanced navigation flows such as opening activities in a new task or clearing the back stack. In our case, we used this to reliably open a specific settings page; without the appropriate flag, the system would often restore the previously opened settings screen instead of the intended destination. This behavior is consistent with Android’s native intent handling. The implementation is fully backward-compatible (existing behavior is preserved when no flags are provided) and enhances the module’s flexibility without requiring native code overrides.
This PR is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.