Error: "No Image Selected" when select take picture from PHOTOLIBRARY
Bug Report
Problem
It always returns "No Image Selected" when source is PHOTOLIBRARY
What is expected to happen?
when I call getPicture()
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
constructor(private camera: Camera) {}
async getPicture() {
const options: CameraOptions = {
allowEdit: false,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.camera.DestinationType.FILE_URI
};
try {
const imagePath = await this.camera.getPicture(options);
console.log("Success: ", imagePath);
} catch(e) {
console.log("Error: ",e);
}
}
should return a fileURL
What does actually happen?
It always throw error "No Image Selected".
Information
I tested on Android 10. it still worked
Command or Code
Environment, Platform, Device
Device: Xiaomi Redmi note 9 pro
Platform: Android
Version: Android 11
Version information
Ionic:
Ionic CLI : 6.17.1 (.../.nvm/versions/node/v14.17.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.8.4
@angular-devkit/build-angular : 12.1.4
@angular-devkit/schematics : 12.2.10
@angular/cli : 12.2.10
@ionic/angular-toolkit : 4.0.0
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 10.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 5 other plugins)
Utility:
cordova-res : 0.15.3
native-run (update available: 1.5.0) : 1.4.0
System:
Android SDK Tools : 26.1.1 (.../Library/Android/sdk)
ios-deploy : 1.11.4
ios-sim : ios-sim/9.0.0 darwin-x64 node-v14.17.1
NodeJS : v14.17.1 (.../.nvm/versions/node/v14.17.1/bin/node)
npm : 7.19.0
OS : macOS Big Sur
Xcode : Xcode 13.0 Build version 13A233
Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Same Problem.
I guess it happens on all Android 11 MIUI phones? Same on: Device: Xiaomi Redmi Note 10s Platform: Android Version: Android 11 MIUI Version: 12.5.13
I guess it happens on all Android 11 MIUI phones? Same on: Device: Xiaomi Redmi Note 10s Platform: Android Version: Android 11 MIUI Version: 12.5.13
i try it on same MIUI version on XIAOMI Mi 10T Pro 5G
//Edit same problem on samsung devices
has anyone success with the issue?
Add the following line to your config.xml: <preference name="AndroidLaunchMode" value="singleTop" />
Add the following line to your config.xml:
<preference name="AndroidLaunchMode" value="singleTop" />
in my case, same problem with the line. :(
Any news on that one ? Got the same problem on Xiami Mi 11 with MIUI 12.5.5 Android 11. App is targeting SDK 30
@iPwa97 @gidiChernyakov If you've got this problem on Xiaomi device, do you have MIUI optimization option turned off on your Developer options ? In my case the bug go away if I turn on that option. It may not be a problem for regular users then ?