On Android 6.0+, we’re checking for the storage permission (or requesting it if needed). It’s coming back saying it is granted, but then the media.save call fails saying the permission is not granted.
I’m printing out to make sure, and this is the sequence:
call isStoragePermissionGranted( system.getInfo( "grantedAppPermissions" ) ) table: 0xca960ee0 { [1] =\> "android.permission.INTERNET" [2] =\> "Storage" ...plus others } call media.save I/Corona(15340): ERROR: Saving Images requires access to the device's Storage! I/Corona(15340): Ensure that your app is using the "android.permission.WRITE\_EXTERNAL\_STORAGE" permission.
It says right there in the system.getInfo( “grantedAppPermissions” ) call that the permission is granted, but then when it comes to calling media.save, it immediately throws an error saying the permission is not granted.
How is this possible?
If we go into the settings app, it also shows the Storage permission as being granted. Could it maybe be that Corona is only checking for “android.permission.WRITE_EXTERNAL_STORAGE” before trying to save, and not the “Storage” permission group?
Edit: I tried following some advice from Corona dev Scott Harrison, to change “Storage” to “android.permission.WRITE_EXTERNAL_STORAGE”. For some reason we then get the Corona error before we even try and save. It now shows the error when we call native.showPopup( “requestAppPermission”, options )