Open willPHPwork opened 1 year ago
me too brother. :(
We've had no problems checking or requesting the CAMERA permission using this plugin and are also targeting SDK 13, and have tested this successfully on real Android 11, 12 and 13 devices, where we've then been able to access the camera after granting the permission.
Here are our relevant API level settings from config.xml:
<preference name="android-minSdkVersion" value="30" />
<preference name="android-targetSdkVersion" value="33" />
<preference name="android-compileSdkVersion" value="33" />
Possibly if you don't have it, you may want to try changing the compileSdkVersion to 33 as well as the targetSdkVersion? Not sure if that will help but wouldn't hurt to try. Our minSdkVersion is just to limit our users to Android 11 or higher as we don't want to support earlier versions than that.
We also have these settings in the config.xml, that you will also need for the camera permission:
<platform name="android">
<config-file parent="/*" platform="android" target="AndroidManifest.xml">
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
</config-file>
</platform>
Editing to add that our Cordova Android platform is v12.0.1.
Hi ppl,
Any workaround about this ?
Im facing the same problem :
I do use permChecker.requestPermission(permChecker.CAMERA, success, err)
.
But, success callback is called and response in it indicates : {hasPermission: false}
but isnt showing at all android perm asking popup.
But if i just ignore this plugin and allow android to handle it by itself, popup is showing and everything goes well.
My assumption is that maybe Android changed something in android 13 that now, prevent this plugin to show permission asking popup.
But im no native dev.
Any more ideas about this ?
@NeilCresswell Are you sure that permissions werent granted before you tested your implementation ? As it's working like a charm with no popup showing if i do has permission prior to call the plugin. but if not, i always get hasPermission: false (which is right) but the popup asking for it isnt showing
Hi, i am facing the same problem with request permission (permission.WRITE_EXTERNAL_STORAGE) in Android 13,target SDK 33.It returns haspermission false always without asking permission pop. It's working fine in Android 12 or below. I have already upgraded my target and compile SDK version to 33 . Any solution or workaround?
android-targetSdkVersion:33 android-compileSdkVersion:33 Android: 13
I have the same problem. requestPermissions() doesn't show permission popup.
Same problem here. requestPermissions() doesn't show permission popup.
Any workaround about this ?
android-minSdkVersion" value="22" android-targetSdkVersion" value="33" android-compileSdkVersion" value="33"
Same problem, no error.
Cordova android 10.1.2 android-targetSDKVersion=33 android-minSdkVersion=30 android-compileSdkVersion=33
Hi all,
just in case this helps someone:
I had the same issue where I couldn't get the Camera permission to pop up and the solution pretty much was what Neil suggested in this post.
The plugin cannot request permissions that aren't declared in AndroidManifest.xml
To my surprise, cordova-plugin-camera
doesn't actually use the Camera permission, as they don't use the Camera directly.
So I've had to add the permission semi-manually. To my config.xml
, I've added the following:
<config-file parent="/manifest" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.CAMERA" />
</config-file>
After that, I received aapt error while building, the solution to that was to modify the <widget>
tag in the config.xml
I've added the following attribute to the <widget>
tag:
xmlns:android="http://schemas.android.com/apk/res/android"
All credit goes to Neil and this post: https://github.com/NeoLSN/cordova-plugin-android-permissions/issues/84
Thank you guys for solving this headache for me.
Also, I'm on cordova-android 11.0.0
Hi, thank you all for participating in this beautiful plugin.
I would appreciate it if you guys can help me out here. I'm using ionic 7 on android 13 with this plugin. However, the when trying to read a file from the External filesystem, i get this error:
'Error launching app update Please grant read external storage permission'.
Then when I try to run this code:
` const permissions = cordova.plugins.permissions; console.log(permissions);
await permissions.checkPermission(permissions['READ_EXTERNAL_STORAGE'], async checkResult => { console.log(checkResult); if (!checkResult.hasPermission) { await permissions.requestPermission(permissions['READ_EXTERNAL_STORAGE'], async requestResult => {
console.log(requestResult);
}, err => {
console.log('err', err);
});
} else {
console.log(`already granted`);
}
}, err => { console.log('err', err);
});`
I get {hasPermission: false}
on both has and requestPermission. I already have defined the permission in my AndroidManifest.xml
`
`
Same result with REQUEST_INSTALL_PACKAGES. I have no idea what to do here, I've been stuck on this for 2 days now straight. Any insight or help would be greatly rewarded with appreciation :3
READ_EXTERNAL_STORAGE doesn't exist from API level 33, you can't request it and system will not grant it. External storage is complicated from Android 13 - https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions
Sorry guys for late , here is the solution I think we need to keep adding that for every persmission we gonna use from now on
<platform name="android">
<config-file parent="/*" platform="android" target="AndroidManifest.xml">
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
</config-file>
....
I'm using permissions.requestPermission(permission, successCallback, errorCallback); but nothing shows up. I an on android 13 and SDK 33.
Has a success callback but shows hasPermission: false without showing ability to grand permission.
Works fine in Android 12.