Coder Social home page Coder Social logo

cordova-plugin-filepath's People

Contributors

angjelkom avatar chrizc avatar dwlrathod avatar hiddentao avatar jbagaresgaray avatar kukukk avatar libinvarghese avatar mohammadwaleed avatar muhassar avatar nmatpt avatar olaferlandsen avatar roncemer avatar thibaudsowa avatar vincekd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-filepath's Issues

Do not request permissions until necessary

Currently the plugin requests file permissions on initialisation. This can be off-putting to the user if they are just sampling the app and are not using its file-related features.

Instead the plugin should request file permissions when it is executed for the first time, i.e. when resolveNativePath is called.

Google Drive content://

Hi, thanks for this plugin. It helped me to manage intent content:// url. It works well with Google Photos and Dropbox on Android, but I cannot make it work with Google Drive. Here what I receive with window.resolveLocalFileSystemUrl:

{
  "isFile": true,
  "isDirectory": false,
  "name": "enc=fhNPFErrgrEv9o4Q0EfWItmhwQRdSI8diNatIJQGsbDn8UOC\n",
  "fullPath": "/com.google.android.apps.docs.storage.legacy/enc=fhNPFErrgrEv9o4Q0EfWItmhwQRdSI8diNatIJQGsbDn8UOC\n",
  "filesystem": "<FileSystem: content>",
  "nativeURL": "content://com.google.android.apps.docs.storage.legacy/enc%3DfhNPFErrgrEv9o4Q0EfWItmhwQRdSI8diNatIJQGsbDn8UOC%0A"
}

You can see the incoming content:// in nativeURL: content://com.google.android.apps.docs.storage.legacy/enc%3DfhNPFErrgrEv9o4Q0EfWItmhwQRdSI8diNatIJQGsbDn8UOC%0A

I tried to find a resource about this com.google.android.apps.docs.storage.legacy/enc=<something> but without any success.

Here is what I received with your plugin resolveNativePath:

{
  "code": 0,
  "message": "Unable to resolve filesystem path."
}

[Blocker] resolveNativePath is failing in android 11

cordova-plugin-filechooser 1.2.0 "File Chooser"
cordova-plugin-filepath 1.6.0 "cordova-plugin-filepath"

Unable to read file native path in android 11. This is only happening for files that are uploaded from the download folder.

this.fileChooser.open()
        .then(uri => {
          let pdfname = uri.substring(uri.lastIndexOf("/") + 1);
          let pdfExt = pdfname.substr(pdfname.lastIndexOf('.') + 1);
          if (pdfExt == 'pdf') {
            // let name = pdfname.split('.').slice(0, -1).join('.');
            this.processPDF(uri, '');
          }
          else {
            this.filePath.resolveNativePath(uri)
              .then(file => {
                let filename = file.substring(file.lastIndexOf("/") + 1);
                let fileExt = filename.substr(filename.lastIndexOf('.') + 1);
                if (fileExt == 'pdf') {
                  
                }
               
              })
              .catch(err => {
                // Here err is {code: 0, message: 'Unable to resolve filesystem path. hahahha'}
              });
          }
        })

Permission denial on Android 7.1.2

Hi,

I observed that the plugin is no longer actively maintained, but maybe it will be useful...

I'm trying to use the plugin on Android 7.1.2, but I get the following error:

java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/video/media from pid=6197, uid=10108 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()

Is it because of the new way Android handles permission and the app should request permission at runtime?

cordova-plugin-filepath Plugin not installed android

ur connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/Cellar/node/8.4.0/bin/node" "/User/node_modules/.bin/npm" "install" "[email protected]" "--production" "--save"
npm ERR! node v8.4.0
npm ERR! npm v2.15.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package @angular/[email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected]
npm ERR! peerinvalid Peer [email protected] wants @angular/[email protected]

npm ERR! Please include the following file with any support request:
npm ERR! /Users/npm-debug.log

Unneeded WRITE_EXTERNAL_STORAGE?

This plugin asks for unneeded android.permission.WRITE_EXTERNAL_STORAGE which could prevent some users from downloading our app if we can't provide a reasonable explanation, looking into the plugin's code I don't see a need to WRITE to storage, as we only resolve the path here could you please @hiddentao elaborate?

cordova-plugin-filepath: Unable to resolve filesystem path in android

Trying to upload image from ionic application via android/ios gallery. It's working perfectly fine on ios but throw error in android.
It always throw following error while resolving native path in this.filePath.resolveNativePath(imagePath) method:
{code: 0 ; message: "Unable to resolve filesystem path."}

Here is my code for uploading image:

var options = {
  quality: 60,
  targetWidth:900,
  sourceType: sourceType,
  saveToPhotoAlbum: false,
  correctOrientation: true
};
// Get the data of an image
this.camera.getPicture(options).then((imagePath) => {
  if (this.platform.is('android') && sourceType === this.camera.PictureSourceType.PHOTOLIBRARY) {
    console.log('image path',imagePath)
    this.filePath.resolveNativePath(imagePath)
      .then(res => {
        let correctPath = res.substr(0, res.lastIndexOf('/') + 1).toString();
        let currentName = imagePath.substring(imagePath.lastIndexOf('/') + 1, imagePath.length).toString();
        this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
      }).catch(err=>{
        console.log('unable to resolve file path issue', err)
      });
  } else {
    var currentName = imagePath.substr(imagePath.lastIndexOf('/') + 1);
    var correctPath = imagePath.substr(0, imagePath.lastIndexOf('/') + 1);
    console.log(currentName,correctPath)
    this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
  }
}, (err) => {
  console.log(err);
});

I have even tried using following code but no success:

window.FilePath.resolveNativePath(imagePath)
      .then(res => {
        let correctPath = res.substr(0, res.lastIndexOf('/') + 1).toString();
        let currentName = imagePath.substring(imagePath.lastIndexOf('/') + 1, imagePath.length).toString();
        this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
      }).catch(err=>{
        console.log('unable to resolve file path issue', err)
      });

Here are my plugin details:

<plugin name="cordova-plugin-camera" spec="^4.0.3" />
<plugin name="cordova-plugin-filepath" spec="^1.4.2" />

Ionic info

   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1
Cordova:
   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 15 other plugins)
System:
   Android SDK Tools : 25.2.4
   NodeJS            : v9.11.1
   npm               : 6.0.1 
   OS                : Windows 10

Unable to resolve Google Photos path

Hi,

I'm getting error {code: 0, message: "Unable to resolve filesystem path."} when trying to resolve Google Photos path content://com.google.android.apps.photos.contentprovider/2/1/mediakey%3A%2Flocal%253A5c48eb7f-3ec9-4dbf-83bf-42643a8132bb/ORIGINAL/NONE/559741294 with FilePath.resolveNativePath

Device is Huawei P10 (VTR-L29) running Android 8.0.0 API 26

New Issue

Type 'FilePathOriginal' is not assignable to type 'Provider'.
Type 'FilePathOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactory

Invalid column_data Error Message

I got this message "Invalid column_data"

`

window.FilePath.resolveNativePath(key.photos[0].value, function(filePath){
alert("Success : " + filePath);
}, function (err) {
alert("Error : "+ JSON.stringify(err));
});

`
would you please guide me

Ionic Capacitor Angular with Android 11 uri -> resolveNativePath -> Unable to resolve filesystem path

I am facing issue in Android 11 while using cordova-plugin-multiple-documents-picker and @ionic-native/multiple-document-picker to choose PDF document

Upload from Download folder working fine

  1. Uploading from document folder or filtering document or traversing to document folder in directory(Example Whatsapp folder)
  2. Facing issue in getting filepath

this.multipleDocumentsPicker .pick(2) .then((res: any) => { console.log(JSON.parse(res)); const uploadPdfData = JSON.parse(res); const uploadDataDetails: any = []; let resolvedPath: any; let promises: any[] = []; for (let i = 0; i < uploadPdfData.length; i++) { const obj: any = {}; resolvedPath = this.filePath .resolveNativePath(uploadPdfData[i].uri) .then((path) => { console.log('>>>>>>>>>', path); obj.name = uploadPdfData[i].name; obj.filePath = path; obj.type = 'pdf'; obj.size = uploadPdfData[i].size; uploadDataDetails.push(obj); }); promises.push(resolvedPath); } }) .catch((error: any) => console.error(error));

Response data => [{name: "demo.pdf"
size: 12972
type: "application/pdf"
uri: "content://com.android.providers.media.documents/document/document%3A14627"}]

URI: content://com.android.providers.media.documents/document/document:A14627
this.filePath.resolveNativePath(uploadPdfData[i].uri) -> ERROR
ERROR Error: Uncaught (in promise): Object: {"code":0,"message":"Unable to resolve filesystem path."}

@hiddentao Please check urgent issue

OpenInputstream FileNotFoundException

Hello can anyone tell me the solution , I am getting FileNotFoundException in below code
InputStream is = context.getContentResolver().openInputStream(uri);
^

Error in src/android/FilePath.java

Hello,

We found some error in FilePath.java
It's not a big mistake, but I think it's good to modify it. I do not know why our project has a problem to understand it. We are seeing why.
The error is on line 340 .: return uri.getPath (). ReplaceFirst ("^ / document / raw:", "") .replaceFirst ("^ raw:", "") ;;
We find two ';' followed. And our project says it's a mistake.

Thank you

Bea

Different file paths returned depending on method of selection (Android 8)

I've just noticed something strange about picking files with the "file chooser" that this launches on Android 8..

in this scenario, I'm trying to import a JSON file that I've downloaded, so naturally it's currently sitting in my device's "Download" folder. when the file chooser opens, by default the left sidebar has the usual source options like "Images", "Videos", "Audio" and "Recent". after this it shows "Downloads" and "Documents" before listing other apps that can be used to choose a file.

if I close this sidebar and open the kebab menu in the top right corner, I have an option to "Show internal storage". after this, I now see another option below "Documents" that lists my device's name, providing access to my device internal storage. in this route, I simply open the "Download" folder and I see the exact same files as the "Downloads" shortcut in the sidebar.

this is where things get interesting... I put some console.log calls at key points to see what was going on, thereby ending up with the following code:

this.fileChooser.open().then((uri) => {
  console.log(`fileChooser.open() result: "${uri}"`);
  return this.filePath.resolveNativePath(uri).then((fileEntry) => {
    console.log(`filePath.resolveNativePath(uri) result: "${fileEntry}"`);
    let path = fileEntry.substring(0, fileEntry.lastIndexOf("/"));
    let file = fileEntry.substring(fileEntry.lastIndexOf("/") + 1, fileEntry.length);
    console.log(`about to call readAsText() with: "${path}" "${file}`);
    return this.file.readAsText(path, file).then((content) => { ... });
  });
}).

as for the different ways of choosing the file, this is what I discovered:

when selected via "Downloads" sidebar shortcut:

  • fileChooser.open() result: "content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2Fcustom-folder%2Fmy-custom-file.json"
  • filePath.resolveNativePath(uri) result: "file:///storage/emulated/0/Download/my-custom-file.json"
  • about to call readAsText() with: "file:///storage/emulated/0/Download" "my-custom-file.json

when selected via "browse internal storage":

  • fileChooser.open() result: "content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2Fcustom-folder%2Fmy-custom-file.json"
  • filePath.resolveNativePath(uri) result: "file:///storage/emulated/0/Download/custom-folder/my-custom-file.json"
  • about to call readAsText() with: "file:///storage/emulated/0/Download/custom-folder" "my-custom-file.json

from what I can see, the path is fine up to the point that I use cordova-plugin-filepath to resolveNativePath().. so is this a bug in this plugin or am I simply misunderstanding something here?

Chrome downloads not handled

I'm trying to get the path of a download from Chrome, and it's not handled by this plugin:

content://com.android.chrome.FileProvider/downloads/advent.ulx

Now I know this plugin is not being heavily developed at present. If anyone is aware of an alternative plugin that would handle it, that would be greatly appreciated!

Edit: for my use case, the path is not fully necessary, as long as I can get the data from it.

Unable to resolve filesystem path from external storage (sd-memory)

content://com.android.externalstorage.documents/document/0E49-D59B%3A.android_secure

java.lang.Exception: Unable to resolve filesystem path for content://com.android.externalstorage.documents/document/0E49-D59B%3A.android_secure

Any idea of what happen when trying to solve a path from a SD Memory ?

"Unknown URI" for downloaded document

Trying to get file path for a downloaded document I get an error:

Unknown URI: content://downloads/public_downloads/12627

Content URI provided was:
content://com.android.providers.downloads.documents/document/12627

It seems that files downloaded using Chrome or Gmail are stored this way. Am I missing something? Taking a look at your code it seems that since Android 8 (which I'm running on) you expect something that contains raw inside the content URI. But in my case it's lacking the raw part?

Error: column '_data' does not exist

On Android 9 and DropBox, works with GoogleDrive
The path from cordova file chooser plugin https://github.com/ihadeed/cordova-filechooser
content://com.dropbox.android.FileCache/filecache/445f6e95-75b4-4b3a-b36e-5b307244c22d
The log:

E/PluginManager: Uncaught exception from plugin
java.lang.IllegalArgumentException: column '_data' does not exist. Available columns: []
at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:340)
at android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87)
at com.hiddentao.cordova.filepath.FilePath.getDataColumn(FilePath.java:208)
at com.hiddentao.cordova.filepath.FilePath.getPath(FilePath.java:407)
at com.hiddentao.cordova.filepath.FilePath.resolveNativePath(FilePath.java:104)
at com.hiddentao.cordova.filepath.FilePath.execute(FilePath.java:76)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:386)
at android.os.Looper.loop(Looper.java:169)
at android.os.HandlerThread.run(HandlerThread.java:65)

Looking for new maintainers

Hey everyone, I haven't done Cordova development for a while now and don't planning on getting back to it any time soon. But this plugin still seems to be useful to people, so am happy for anyone to step up and take over as the project maintainer. At present @tanasebutcaru is the only co-contributor on this project.

@tanasebutcaru Would you like to take over this project and keep it up-to-date for people?

Cordova FilePath returns Invalid column _data for image uri from contacts cordova plugin

I'm trying to get the file path from an URI returned by the cordova contacts plugin using the resolveNativePath from filepath plugin.

contactsImageURI = contact.photo[0].value;
contactsImageURI = content://com.android.contacts/contacts/XXXX/photo;
this.filePath.resolveNativePath((contactsImageURI)).then(()=> {
console.log('success');
}).catch((error: any)) => {
console.log(error);
});
// output Invalid column _data

can anyone help me out

Error found when file is fetched from GDrive.

I am fetching a file from GDrive and passed file path to filePath and using resolveNativePath function below line of code
window.FilePath.resolveNativePath(filePath, successCallback, errorCallback);
Now i am getting Error Unable to resolve filesystem path with Code 0 .
why this error come only in GDrive but not in Dropbox or local file system.

cordova-plugin-filepath Crash Report

I got the below error in the play store crash report. In any block we can't able to find the solution and root cause of this issue.

Mainly this is occurred for Motorola and Huawei devices.

Android 7,9

Full stack-trace:

java.lang.RuntimeException:
at android.app.ActivityThread.deliverResults (ActivityThread.java:5078)
at android.app.ActivityThread.handleSendResult (ActivityThread.java:5120)
at android.app.servertransaction.ActivityResultItem.execute (ActivityResultItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2199)
at android.os.Handler.dispatchMessage (Handler.java:112)
at android.os.Looper.loop (Looper.java:216)
at android.app.ActivityThread.main (ActivityThread.java:7625)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:987)
Caused by: java.lang.IllegalArgumentException:
at android.database.AbstractCursor.getColumnIndexOrThrow (AbstractCursor.java:340)
at android.database.CursorWrapper.getColumnIndexOrThrow (CursorWrapper.java:87)
at com.hiddentao.cordova.filepath.FilePath.getDataColumn (FilePath.java:215)
at com.hiddentao.cordova.filepath.FilePath.getPath (FilePath.java:410)
at com.hiddentao.cordova.filepath.FilePath.resolveNativePath (FilePath.java:103)
at com.hiddentao.cordova.filepath.FilePath.onRequestPermissionResult (FilePath.java:138)
at org.apache.cordova.CordovaInterfaceImpl.onRequestPermissionResult (CordovaInterfaceImpl.java:221)
at org.apache.cordova.CordovaActivity.onRequestPermissionsResult (CordovaActivity.java:509)
at android.app.Activity.dispatchRequestPermissionsResult (Activity.java:7951)
at android.app.Activity.dispatchActivityResult (Activity.java:7801)
at android.app.ActivityThread.deliverResults (ActivityThread.java:5071)

Ionic details:
Ionic CLI : 5.4.16 (C:\Users\2304435\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.11.2
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0

Cordova:

Cordova CLI : 8.1.2 ([email protected])
Cordova Platforms : not available
Cordova Plugins : not available

Utility:

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

System:

Android SDK Tools : 26.1.1 (E:\Softwares\SDK\IONIC\android-sdk-windows-1.6_r1)
NodeJS : v12.16.1 (C:\Program Files\nodejs\node.exe)
npm : 6.13.4
OS : Windows 10

TypeError: Cannot read property 'resolveNativePath' of undefined

I was testing this plugin.
I'm keep getting following error
"TypeError: Cannot read property 'resolveNativePath' of undefined"

am I missing something?

I added following code for the testing.

var uripath = 'content://com.google.android.apps.photos.contentprovider/0/1/content/';

window.FilePath.resolveNativePath(uripath, function(filePath){
alert("Success : " + filePath);
}, function (err) {
alert("Error : "+ JSON.stringify(err));
});

This plugin conflicts with many others

Please update the android version in the package.json to support a wider variety of android versions.

This plugin conflicts with both the firebase and admob plugins, causing this error:

:app:processDebugManifest/home/rcemer/projects/flatulatron/app/platforms/android/app/src/main/AndroidManifest.xml:28:13-35 Error:
Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.

This is not something which can be resolved when using cordova, as it generates AndroidManifest.xml automatically.

cordova platform list
Installed platforms:
android 7.1.4

cordova plugin list
cordova-admob 5.1.0 "AdMob Google Ads + Tappx"
cordova-connectivity-monitor 1.2.2 "Connectivity Monitoring"
cordova-play-services-version-adapter 1.0.2 "Cordova/Ionic Google Play Services Versions Incompatibility Adapter"
cordova-plugin-android-downloadmanager 0.5.0 "cordova-plugin-android-downloadmanager"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-filechooser 1.2.0 "File Chooser"
cordova-plugin-filepath 1.5.1 "cordova-plugin-filepath"
cordova-plugin-permission 0.1.0 "Permission"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 2.6.0 "Cordova sqlite storage plugin"

Specifically, cordova-plugin-filepath causes a problem when I try to use it with cordova-admob.

Go here https://www.npmjs.com/package/cordova-admob and try creating an admob-enabled dummy app, then try to add your cordova-plugin-filepath plugin to it and try to build. You can easily reproduce the error that way. Or, try cordova-plugin-filepath with the firebase plugin.

Basically, cordova-plugin-filepath needs to not be so anal with regard to the Android version, because it's rendering itself pretty much useless by doing so.

Please fix right away, and notify me when it's fixed. I'm trying to complete a project, and this is holding me up.

How to get file extension ?

im not getting file extension if there is a space between file name.

example:
shock life.png

im not getting .png if there is a space in fiile name.

Error: column '_data' does not exist

Hello! I tried to get a native path for Dropbox file. Imported with https://github.com/ihadeed/cordova-filechooser

this.filePath.resolveNativePath(uri).then((localFileUri) => {
    this.logger.debug(localFileUri);
}).catch((err) => {
    this.logger.error(err);
});

, where uri = "content://com.dropbox.android.FileCache/filecache/43876dac-1263-4824-9653-6fd60be9fcff"

Android 5.0 (API version 21)

Full stack-trace:

08-06 14:36:11.538 4565-4671/com.ml E/PluginManager: Uncaught exception from plugin
java.lang.IllegalArgumentException: column '_data' does not exist
    at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:333)
    at android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87)
    at com.hiddentao.cordova.filepath.FilePath.getDataColumn(FilePath.java:160)
    at com.hiddentao.cordova.filepath.FilePath.getPath(FilePath.java:331)
    at com.hiddentao.cordova.filepath.FilePath.execute(FilePath.java:62)
    at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
    at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
    at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
    at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
    at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
    at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:41)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.os.HandlerThread.run(HandlerThread.java:65)

Ionic info:

cli packages: (/Users/bushev/IdeaProjects/MongoLime/node_modules)

    @ionic/cli-plugin-cordova       : 1.6.2
    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0

System:

    Android SDK Tools : 26.0.2
    Node              : v6.11.1
    OS                : macOS Sierra
    Xcode             : Xcode 8.3.3 Build version 8E3004b 
    ios-deploy        : 1.9.1 
    npm               : 3.10.10 

FilePath.java:16: error: package android.support.v4.app does not exist

"cordova-plugin-filepath" spec="1.5.4" fails on
ionic cordova run android --device --no-build -- --verbose
with

/.../test-filepath/platforms/android/app/src/main/java/com/hiddentao/cordova/filepath/FilePath.java:16: error: package android.support.v4.app does not exist
import android.support.v4.app.ActivityCompat;
                             ^
1 error
:app:compileDebugJavaWithJavac FAILED

BUILD FAILED in 2s
Error: /.../workspace/test-filepath/platforms/android/gradlew: Command failed with exit code 1 Error output:
/.../workspace/test-filepath/platforms/android/app/src/main/java/com/hiddentao/cordova/filepath/FilePath.java:16: error: package android.support.v4.app does not exist
import android.support.v4.app.ActivityCompat;
                             ^
1 error

FAILURE: Build failed with an exception.

Steps to reproduce
prepare empty project

ionic start test-filepath blank --type=ionic-angular
ionic build --prod
ionic cordova run android --device --no-build --   --verbose
rm -rf .git
git init
git add -A
git commit -m 'initial state'

add plugin and reproduce the bug

ionic cordova plugin add cordova-plugin-filepath
ionic cordova run android --device --no-build --   --verbose

ionic info

Ionic:

ionic (Ionic CLI) : 4.10.3 (/.../.nvm/versions/node/v10.15.0/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.5
@ionic/app-scripts : 3.2.2

Cordova:

cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 5 other plugins)

System:

Android SDK Tools : 26.1.1 (/.../Library/Android/sdk)
ios-deploy : 1.9.4
ios-sim : 8.0.0
NodeJS : v10.15.0 (/.../.nvm/versions/node/v10.15.0/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>MyApp</name>
    <description>An awesome Ionic/Cordova app.</description>
    <author email="[email protected]" href="http://ionicframework.com/">Ionic Framework Team</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="android-minSdkVersion" value="19" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/[email protected]" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/[email protected]" width="80" />
        <icon height="120" src="resources/ios/icon/[email protected]" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/[email protected]" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/[email protected]" width="120" />
        <icon height="180" src="resources/ios/icon/[email protected]" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/[email protected]" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/[email protected]" width="152" />
        <icon height="167" src="resources/ios/icon/[email protected]" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/[email protected]" width="58" />
        <icon height="87" src="resources/ios/icon/[email protected]" width="87" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
    </platform>
    <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <plugin name="cordova-plugin-statusbar" spec="2.4.2" />
    <plugin name="cordova-plugin-device" spec="2.0.2" />
    <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
    <plugin name="cordova-plugin-ionic-webview" spec="^4.0.0" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
    <plugin name="cordova-plugin-filepath" spec="1.5.4" />
    <engine name="android" spec="7.1.4" />
</widget>

From whatsapp to my cordova app

I keep getting a column __data doesn't exist error when sharing from whatsapp to my app.
It only works on gallery and only on certain images.
My phone is Android 7.0
This does work on Android 6.0

FilePath Plugin - plugin_not_installed

Everything was working fine since suddenly today I got this 2 warnings. I will add them below.
I tried:
ionic cordova plugin add cordova-plugin-filepath
npm install @ionic-native/file-path

I added FilePath to app.module.ts inside providers.

But still it shows the plugin not installed.

1.Native: tried calling FilePath.resolveNativePath, but the FilePath plugin is not installed.
2.Install the FilePath plugin: 'ionic cordova plugin add cordova-plugin-filepath'

And then the error: plugin_not_installed.

core.js:15724 ERROR Error: Uncaught (in promise): plugin_not_installed
at resolvePromise (zone.js:831)
at zone.js:896
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17290)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at drainMicroTaskQueue (zone.js:601)

cordova-plugin-filepath Crash Report:java.lang.NumberFormatException

i use cordova-plugin-filechooser(1.2.0) choose file, then use this plugin (1.6.0) convert the content uri to native "file://" like uri, but i got this err:
E/PluginManager: Uncaught exception from plugin java.lang.NumberFormatException: For input string: "raw:/storage/emulated/0/Download/Browser/libusb-1.0.24.7z" at java.lang.Long.parseLong(Long.java:594) at java.lang.Long.valueOf(Long.java:808) at com.hiddentao.cordova.filepath.FilePath.getPath(FilePath.java:370) at com.hiddentao.cordova.filepath.FilePath.resolveNativePath(FilePath.java:103) at com.hiddentao.cordova.filepath.FilePath.execute(FilePath.java:75) at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98) at org.apache.cordova.PluginManager.exec(PluginManager.java:132) at com.getcapacitor.MessageHandler.callCordovaPluginMethod(MessageHandler.java:107) at com.getcapacitor.MessageHandler.postMessage(MessageHandler.java:51) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:336) at android.os.Looper.loop(Looper.java:184) at android.os.HandlerThread.run(HandlerThread.java:67)

it seems like the plugin was crashed.
the original content uri is "content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2FBrowser%2Flibusb-1.0.24.7z"

System environment:
android 10(realme V15)

Ionic info:
Ionic:

Ionic CLI : 6.13.1 (C:\Users\User\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 5.5.2
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3

Capacitor:

Capacitor CLI : 2.4.6
@capacitor/core : 2.4.6

Utility:

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

System:

NodeJS : v14.16.0 (C:\Program Files\nodejs\node.exe)
npm : 6.14.11
OS : Windows 10

Error '_data' does not exist when using with Dropbox

Hi!
I am using the plugin within a Ionic 3.x App. We use the plugin cordova-plugin-filechooser to pick a file on Android - then transform the URI with cordova-plugin-filepath.
Everything works fine except when picking a file from Dropbox.

The FilePicker return the following content-URI:

content://com.dropbox.android.FileCache/filecache/dcded03a-37ed-4bbb-8a88-a8492b4e3ee6

The Filepath Plugin then throws error:

main.js:3888 column '_data' does not exist. Available columns: []

Tests are run on Samsung S9 / Android 9.
Any ideas?
Thanks a lot!
Oli

Could not resolve all files for configuration ':app:debugCompileClasspath'. > Could not find support-core-ui.aar (com.android.support:support-core-ui:25.4.0).

Error: when I install file path native plugin, How to fix this error?????????

FAILED

14 actionable tasks: 1 executed, 13 up-to-date
FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all files for configuration ':app:debugCompileClasspath'.

Could not find support-core-ui.aar (com.android.support:support-core-ui:25.4.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-core-ui/25.4.0/support-core-ui-25.4.0.aar

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 40s
(node:1144) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all files for configuration ':app:debugCompileClasspath'.

Could not find support-core-ui.aar (com.android.support:support-core-ui:25.4.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-core-ui/25.4.0/support-core-ui-25.4.0.aar

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 40s
at ChildProcess.whenDone (C:\Users\aa\bb\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:1144) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1144) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

adds posibility to configure frameworks version via config variable

Different plugins may use different framework versions and sometimes devs need to align them manually. One easy way is to allow to configure framework version via additional plugin variable. Like in phonegap-plugin-push - https://github.com/phonegap/phonegap-plugin-push/blob/master/plugin.xml#L47

Would be good to add similar variables for android support framework. Currently it shows exception:

Error: ./platforms/android/gradlew: Command failed with exit code 1 Error output:
./platforms/android/src/org/chromium/customtabsclient/shared/ServiceConnection.java:32: error: diamond operator is not supported in -source 1.6
        mConnectionCallback = new WeakReference<>(connectionCallback);
                                                ^
  (use -source 7 or higher to enable diamond operator)
./platforms/android/src/org/chromium/customtabsclient/shared/CustomTabsHelper.java:77: error: diamond operator is not supported in -source 1.6
        List<String> packagesSupportingCustomTabs = new ArrayList<>();
                                                                  ^
  (use -source 7 or higher to enable diamond operator)
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileArmv7DebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Plugin not installed ios

Hi there, i use ionic 2, trying remove and add platform, remove and add plugin, but i seen that err

iOS 10.2.

Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.13
OS: OS X El Capitan
Node Version: v6.9.1
Xcode version: Xcode 8.2.1 Build version 8C1002

Permission Denial

I got this error after providing the uri from file chooser.

Reading com.android.provider.media.MediaProvider uri:content//media/external/images/media from pid=4081, uid:10076 require android .permission.READ_EXTERNAL_STORAGE, or grandUriPermission.

Anyone has the same issue?
I use android 23 on Nexus 5x.

Error: column '_data' does not exist

Hello,
I'm sharing file from other apps to my cordova app.
When I share from explorer app, i've got the file uri such as :
file:///sdcard/Audio/SoundRecorder/2019-03-04%2019-36-03.aac

but when I share from 3rd party app (whatsapp in my example), I don't receive a file uri :
content://com.whatsapp.provider.media/item/100492 and then i got “column ‘_data’ does not exist”

    this.filePath.resolveNativePath(receivedFile).then((rslt) => {
          console.log('reslt');
        }).catch((error) => { console.log("error", error) }); //error column '_data' does not exist

ionic info

Ionic:

   ionic (Ionic CLI)  : 4.8.0
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.8

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 6.3.0, browser 5.0.3, ios 4.5.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 1.2.1

System:

   Android SDK Tools : 26.1.1 
   NodeJS            : v8.11.3 
   npm               : 5.6.0
   OS                : Linux 4.15


Can you help me ?

thanks

Error: Registry returned 404 for GET cordova-plugin-filePath

I am building ionic2 app via ionic cloud service and build fails because of this error:
Error: Registry returned 404 for GET on https://registry.npmjs.org/cordova-plugin-filePath

I was checking the url with browser and I am getting an empty object there
{}

I was checking other npm packages and they are all returning content.

I have no idea what can cause this problem... could you contact npmjs.org in the name of code author that what can be wrong? Thanks

Unable to resolve OneDrive Path from content URI

Hi,

I'm getting following wrong path when trying to resolve path from OneDrive:
Content URI that is being passed:
content://com.microsoft.skydrive.content.external/Drive/ID/1/Item/RID/9E862D5A44C3B91C%2148853/Stream/1/Property/TestDocument.pdf
and FilePath.resolveNativePath method returns:
file://TestDocument.pdf

Another example, with following path:
content://com.microsoft.skydrive.content.external/Drive/ID/1/Item/RID/9E862D5A44C3B91C%2143165/Stream/1/Property/MY%20APPLICATION636144021910962040.jpg
Plugin returns file://MY APPLICATION636144021910962040.jpg

Tested on Device:
Google Pixel 3 running on Android 10
Samsung Note 10+ running on Android 9
Samsung s7 edge running on Android 8

Cant Upload File From one Drive and ES Explorer

Getting this uri from one drive =>content://com.microsoft.skydrive.content.StorageAccessProvider/document/content%3A%2F%2Fcom.microsoft.skydrive.content.metadata%2FDrive%2FID%2F1%2FItem%2FID%2F22%2FProperty%2F%3FRefreshOption%3DAutoRefresh%26RefreshTimeOut%3D15000

FROM ES Explorer =>content://com.estrongs.files/storage/emulated/0/drive-download-20181228T073012Z-001/15397290795bc666b738e89_LoudermilkScope.pdf

from ES file explorer the here is two way file way and normal way for uploading file the normal way is not working
Getting error code:1000

resolveNativePath getting error 'uri'. How to debug this one?

At least it should return error object so it will easy to debug. Not getting any clue what is happening here.

It is happening only for pdf & docs files

Here i want native file path to find original file name.

Ionic: 4
@ionic-native/[email protected]
[email protected]

Please any one can help me out.

Note: i am checking this on android emulator not on android device..

`import { FilePath } from '@ionic-native/file-path/ngx';
import { FileChooser } from '@ionic-native/file-chooser/ngx';

this.fileChooser.open().then(fileUri => {
this.filePath.resolveNativePath(fileUri).then(resolvedNativePath => {
}).catch(err=> {
console.log(err); -> it getting 'uri'
})
})`

Realiable way to get external storage path

/**
 * Get external sd card path using reflection
 * @param mContext
 * @param is_removable is external storage removable
 * @return
 */
private static String getExternalStoragePath(Context mContext, boolean is_removable) {

    StorageManager mStorageManager = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE);
    Class<?> storageVolumeClazz = null;
    try {
        storageVolumeClazz = Class.forName("android.os.storage.StorageVolume");
        Method getVolumeList = mStorageManager.getClass().getMethod("getVolumeList");
        Method getPath = storageVolumeClazz.getMethod("getPath");
        Method isRemovable = storageVolumeClazz.getMethod("isRemovable");
        Object result = getVolumeList.invoke(mStorageManager);
        final int length = Array.getLength(result);
        for (int i = 0; i < length; i++) {
            Object storageVolumeElement = Array.get(result, i);
            String path = (String) getPath.invoke(storageVolumeElement);
            boolean removable = (Boolean) isRemovable.invoke(storageVolumeElement);
            if (is_removable == removable) {
                return path;
            }
        }
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return null;
}

java.lang.NullPointerException on FilePath.getDataColumn | Crash Report

This crash happens only for Android 11 and Pixel devices.
Unable to reproduce.

Fatal Exception: java.lang.RuntimeException
Failure delivering result ResultInfo{who=@android:requestPermissions:, request=1, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {xxx.app/xxx.app.MainActivity}: java.lang.NullPointerException: uri

android.app.ActivityThread.deliverResults (ActivityThread.java:5015)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:947)
Caused by java.lang.NullPointerException

java.util.Objects.requireNonNull (Objects.java:245)
android.content.ContentResolver.query (ContentResolver.java:1157)
android.content.ContentResolver.query (ContentResolver.java:1115)
android.content.ContentResolver.query (ContentResolver.java:1071)
> com.hiddentao.cordova.filepath.FilePath.getDataColumn (FilePath.java:212)
com.hiddentao.cordova.filepath.FilePath.getPath (FilePath.java:386)
com.hiddentao.cordova.filepath.FilePath.resolveNativePath (FilePath.java:103)
com.hiddentao.cordova.filepath.FilePath.onRequestPermissionResult (FilePath.java:138)
org.apache.cordova.CordovaInterfaceImpl.onRequestPermissionResult (CordovaInterfaceImpl.java:221)
org.apache.cordova.CordovaActivity.onRequestPermissionsResult (CordovaActivity.java:511)
android.app.Activity.dispatchRequestPermissionsResult (Activity.java:8466)
android.app.Activity.dispatchActivityResult (Activity.java:8314)
android.app.ActivityThread.deliverResults (ActivityThread.java:5008)
android.app.ActivityThread.handleSendResult (ActivityThread.java:5056)
android.app.servertransaction.ActivityResultItem.execute (ActivityResultItem.java:51)
android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:2066)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:223)
android.app.ActivityThread.main (ActivityThread.java:7656)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:592)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:947)

[Android] content:// to file://storage does not get resolve

Bug Report

Problem

When you take pdf anyother file from download you get URI with content://. So in order to resolve i use this package to get file URI path https://www.npmjs.com/package/cordova-plugin-filepath

What is expected to happen?

It should resolve and return file detail

What does actually happen?

It returns error code: 1 // not found

Information

chrome://inspect
image

Command or Code

const options: CameraOptions = {
          quality: 50,
          destinationType: this._camera.DestinationType.FILE_URI,
          mediaType: this._camera.MediaType.ALLMEDIA,
          sourceType: this._camera.PictureSourceType.SAVEDPHOTOALBUM,
          saveToPhotoAlbum: false,
        };
 if (file.indexOf("content://") > -1) {
          console.log("content //", file);
          window.FilePath.resolveNativePath(file, (success) => {
            console.log(success, "content");
            window.resolveLocalFileSystemURL(success, (fileEntry) => {
              console.log(fileEntry, "fileEntry");
              fileEntry.file((finalFile) => {
                console.log(finalFile, "resolve");
                resolve(finalFile);
              });
            });
          });
        }

Environment, Platform, Device

All Android version i think so btw currently i am testing on Android 10

Version information

Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.