cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

After updating to cordova-android 9 can not select files from Google Drive

Open jsBiztech opened this issue 4 years ago • 6 comments

Bug Report

I have recently update cordova-android to 9 and also updated the File plugin and I am not able to select file or video from Google Drive.

Problem

Updating the version has started giving error for selecting files. All other places do work but for Google drive it returns error.

What is expected to happen?

File should be selected

What does actually happen?

File is not being selected unless its image.

Information

  • [x] select file from recent
  • [x] select file from downloads folder
  • [x] select file from any other place
  • [x] select image from Google drive
  • [ ] select video or any other file from Google drive

Errors: 3943-3975/? E/oiface: DynamicFps is not enabled! 1872-4430/? E/TaskPersister: File error accessing recents directory (directory doesn't exist?).

Command or Code

Android studio config:

minSDKVersion: 19
targetSDKVersion: 29
android:requestLegacyExternalStorage="true"
<preference name="AndroidPersistentFileLocation" value="Compatibility" />

Environment, Platform, Device

Android 10

Version information

Ionic:
   Ionic CLI          : 5.2.4
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.4

Cordova:
   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 9.0.0, ios 5.1.1
   Cordova Plugins   : cordova-plugin-file 6.0.2, cordova-plugin-file-opener2 2.0.19, cordova-plugin-file-transfer 1.7.1, cordova-plugin-filechooser 1.2.0, cordova-plugin-filepath 1.5.8, cordova-plugin-filepicker 1.1.6,

Utility:
   cordova-res : 0.15.1 
   native-run  : not installed

System:
   Android SDK Tools : 26.1.1
   ios-sim           : 7.0.0
   NodeJS            : v10.16.2
   npm               : 6.9.0
   OS                : macOS Catalina
   Xcode             : Xcode 10.2 Build version 10E125

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

jsBiztech avatar Oct 21 '20 06:10 jsBiztech

Are you using legacy storage? It might be that it's not possible anymore without this flag, also in 11 it will be even harder. I'm able to select a file or a photo on a android 9 device, haven't tested it on 10 though...

HarelM avatar Oct 30 '20 12:10 HarelM

Hello @HarelM , I have added following flag:

  • android:requestLegacyExternalStorage="true"

I am able to select files and images from Device storage but not from the google drive option.

Hope this helps.

jsBiztech avatar Nov 02 '20 05:11 jsBiztech

Hey @nagdevbharat

A minimal reproduction repo would be a great way to get this started. https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md

Kind regards

PieterVanPoyer avatar Nov 02 '20 08:11 PieterVanPoyer

Hello @PieterVanPoyer ,

It will take time to create a repo. If you can suggest any other troubleshooting options or workarounds?

Hope this helps.

jsBiztech avatar Nov 02 '20 08:11 jsBiztech

Hey

I cannot do any suggestions, I am not really familiar with the file plugin.

Greetings

PieterVanPoyer avatar Nov 02 '20 08:11 PieterVanPoyer

This is dealt with here: https://github.com/apache/cordova-plugin-file/issues/426

alex-steinberg avatar Nov 19 '20 07:11 alex-steinberg

Scoped storage mechanisms prevents reading other apps files.

breautek avatar Jan 25 '23 01:01 breautek