Issue
I have an Ionic, Angular, and capacitor application. And I am using Cordova-diagnostic-plugin in the app. I am using it to download images on phone. and I am facing an issue After updating to Android API 33
Current behavior:
After updating the app to target Android API 33. When I try to download an image, it shows the Storage Request dialog stating to allow the app to access files on your device.
I have tried to request permission again for Android API 33 as you mentioned in the documentation and it doesn't open any permission dialog and shows following message in logs:
Requesting permission for android.permission.READ_EXTERNAL_STORAGE
Requesting permissions
Notifying listeners for event pause
No listeners found for event pause
App paused
Unable to find a Capacitor plugin to handle permission requestCode, trying Cordova plugins 0
Expected behavior:
It should download and store images on the phone after clicking on the download button.
Screenshots
Environment information
- Ionic CLI: 7.1.1
- Ionic Framework: @ionic/angular 7.2.0
- @angular/cli: 16.1.0
- @ionic/angular-toolkit: 9.0.0
Capacitor:
- Capacitor CLI : 5.2.2
- @capacitor/android : 5.2.2
- @capacitor/core : 5.2.2
- @capacitor/ios : 5.2.2
System:
NodeJS : v18.10.0
npm : 8.19.2
Target Android SDK version
33
Plugin Version
"cordova.plugins.diagnostic": "^7.1.2"
Code:
const destinationUri = this.platform.is("android")
? "file:///storage/emulated/0/"
: this.ionicFile.dataDirectory;
const blob: Blob = res.data;
if (this.platform.is("android")) {
try {
await this.ionicFile.checkDir(destinationUri, "dcim/WXS ONE");
} catch {
await this.ionicFile.createDir(destinationUri, "dcim/WXS ONE", false);
}
}
Solution
I have used Capacitor FileSystem to store the image in mobile device
Answered By - Jitendera Kumar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.