processing-android
processing-android copied to clipboard
requestPermission() function is broken
The following code:
color bckColor = #EA6411;
void setup() {
fullScreen();
requestPermission("android.permission.READ_EXTERNAL_STORAGE", "handlePermission");
}
void draw() {
background(bckColor);
}
void handlePermission(boolean granted) {
if (granted) bckColor = #58EA11;
}
should open a dialog for the user to grant read access to external storage, but no dialog is shown.
Hi @codeanticode , what's your device Android API level ?
As per the reference shared by @ranaaditya , It seems including android:requestLegacyExternalStorage="true"
in AndroidManifest.xml can work. Also, It will require testing on newer as well as older Android platform devices. I'll look into it after the current emulator support task(will create a PR for this soon). @codeanticode
@ranaaditya I tested the code on a device running Android 12.
@ranaaditya I tested the code on a device running Android 12.
@codeanticode Yeah, I think that's because of the latest Android API changes only.
I think not only Storage permission but also other permissions have been updated / changed so we need to work on them as well.
No worries we will update processing core will all updates from Android 8 onwards.
I will look into all the changes happened to permission system and other stuff as well and make separate issues for all :+1:
Thanks !
I think this might be an invalid issue, I just realized that I forgot to add the READ_EXTERNAL_STORAGE permission in the manifest file. After doing that, it works.