Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
lucas.180963's avatar
lucas.180963
Explorer
3 years ago
Solved

Requesting permissions not working in Quest OS 59

Since we updated one of our Quest 2 devices to operating system version 59 our android code for requesting permissions no longer works.

private void checkPermissionsAndInitialize() {
// check permissions
List<String> PERMISSIONS = buildPermissionList();

if (mainActivity.hasPermissions(PERMISSIONS.toArray(new String[0]))) {
intialize();
} else {
ActivityCompat.requestPermissions(mainActivity, PERMISSIONS.toArray(new String[0]), PERMISSIONS_REQUEST_CODE);
}
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
intialize();
}

private void intialize() {
Log.d(LOG_TAG, "Build version: " + Build.VERSION.SDK_INT);
}

This snippet should be straightforward but for some reason the if statement always evaluates to false and onRequestPermissionsResult is never called, so the log is never printed. (The 'hasPermissions' method just uses ActivityCompat.checkSelfPermission on an array.)

Also, using 'adb install -g' to grant all runtime permissions doesn't work either!

Has anyone had a problem like this before?

Lucas

3 Replies

Replies have been turned off for this discussion
  • I have found that this is in some way related to replacing an installed app with a 'newer version' of that app.

    When I first remove my application and then install it again (via SideQuest), the permission code works as expected.

    But if I install my application via sidequest when that same application is still installed, the code fails! And this even with the exact same apk I used for the first install!

    • lucas.180963's avatar
      lucas.180963
      Explorer

      The above reply was sort of a false positive. The installation has nothing to do with it. When I open our app for the first time the log is printed, but when I open it a second time it is not.

      Meaning that the bug is not caused by installing another version but simply happens if you open the app again.

  • Headset just updated to 59.0.0.138, bug is fixed! 😄