Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a getter for permissions that require enabling from a settings menu (outside current app) #762

Open
FrederickEngelhardt opened this issue Mar 27, 2023 · 0 comments
Assignees
Labels
feature request New feature or request

Comments

@FrederickEngelhardt
Copy link

FrederickEngelhardt commented Mar 27, 2023

Why it is needed?

For android, any app that has to manage files or storage will need this permission check in order to verify that the permission is enabled.

These changes should include:

  • A check for MANAGE_EXTERNAL_STORAGE, the permission should not be provided in the AndroidManifest. This should only be enabled in the app integrating this library.
  • Possibly a method to navigate to the permission screen (via the openSettings) command. There is a PR for this in react-native-send-intent. I also have an open discussion here regarding extending Linking.sendIntent regarding opening the the MANAGE_EXTERNAL_STORAGE permission via intent for the integrated app.
  • Any other intent identified with a similar flow. IE the app is not where it can be enabled but it can still be permission checked.

Possible implementation

We can do this by adding a check using

We probably can add a method called isExternalStorageManager() and return the permissions state. Not sure if the RESULTS enum will match all states returned from isExternalStorageManager()

Code sample

  @RequiresApi(Build.VERSION_CODES.R)
  @ReactMethod
  override fun isExternalStorageManager(promise: Promise) {
    val isExternalStorageManager = isExternalStorageManager().toString()
    promise.resolve(isExternalStorageManager)
  }

This would return the string of "true" or "false". We can do something with that response on the react-native side such as match it with a specific RESULTS type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants