lucasferreira / react-native-send-intent

React Native Android module to use Android's Intent actions for send text to shareable apps or make phone calls or opening third party apps
419 stars 159 forks source link

openSettings() function should allow an optional package name #70

Open hoda0013 opened 6 years ago

hoda0013 commented 6 years ago

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(); }