I have native module in my React application, I want to navigate the user to the settings
@ReactMethod
public void manageStoragePermission() {
if (Build.VERSION.SDK_INT >= 30) {
if (!Environment.isExternalStorageManager()) {
Intent getpermission = new Intent();
getpermission.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
reactContext.getCurrentActivity().startActivity(getpermission);
}
}
}
I want to wait for the result when the user returns after granting/not granting
permissions. So I tried to start the activity with startActivityForResult()
, but I don't have onActivtyResult()
callback in my module.
I also saw that startActivityForResult()
is deprecated and I should use registerForActivityResult
instead, but I also don't have this method in React's native module.
What is the correct way to wait for the activity result when dealing with native modules?