Skip to content

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

@FrederickEngelhardt

Description

@FrederickEngelhardt

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions