react-native-send-intent icon indicating copy to clipboard operation
react-native-send-intent copied to clipboard

openSettings() function should allow an optional package name

Open hoda0013 opened this issue 6 years ago • 0 comments

Android allows developers to open an app's settings menu directly via an Intent. This can be useful if a user has declined a permission and the dev. wants to deep link the user to their app's settings screen so the user can grant the permission. To do this a developer needs to be able to specify an intent name and a package name.

Here's an example of how a developer would need to create an intent to open an app's settings screen: [(https://developer.android.com/reference/android/provider/Settings.html#ACTION_APPLICATION_DETAILS_SETTINGS)]

I believe an optional argument could be added to the openSettings() method in the android module that, when present, would add the package name as a uri to the intent data:

try { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:" + packageName)); startActivity(intent); } catch (ActivityNotFoundException e){ e.printStackTrace(); }

hoda0013 avatar Jun 18 '18 20:06 hoda0013