Issue
I've read about all the changes in the File system for Android, because of Android 11.
Here is my problem. I'm opening a file using Android File Chooser
from Ionic
.
https://ionicframework.com/docs/native/file-chooser
this.androidFileChooser
.open({ mime: 'application/pdf' })
.then((file) => {
This gives me this response : "content://com.android.providers.downloads.documents/document/11654"
.
The problem is that I need to get the real location of the file to convert it to base 64, and send it with a POST Request to the client server. So before all these problems, I was using Android File Path from Ionic : https://ionicframework.com/docs/native/file-path
this.filePath.resolveNativePath(file).then((filePath) => {
And I was receiving file:///storage/emulated/0/Download/pdffile.pdf
Using this, I could transform it in base64 and everything worked well.
Now, it returns me nothing for Android 11. So All the process can't work if I don't have this filepath.
Do you have a solution for Angular/Ionic, to get the file Path for a file, for Android 11? This is very problematic.
Solution
After some researches, it seems that Cordova doesn't target API 30 and the new changes in its scope. To solve my problem, I use Ionic Chooser, but using this one is problematic for the mimetype for Android (It allows to upload images from Google Drive when you set the mimetype to application/pdf). That's a loss for a win. I hope Cordova plugins maintainers will bring some solutions to these changes.
Answered By - Shinichi Kudo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.