Get filepath of file on Android with Cordova

88 views Asked by At

Is there any way to get the file path of a file on Android, which contains content://...?

I saw that there is this plugin https://github.com/hiddentao/cordova-plugin-filepath, but as it has been deprecated, I consider it risky to use a plugin that is no longer supported.

2

There are 2 answers

0
jamsandwich On

The cordova-plugin-filepath plugin no longer works with newer versions of Android, however there is a fork which has been updated and I have had success with: https://github.com/eusi/cordova-plugin-filepath

0
Mister_CK On

We use that plugin in our current project.

A lot of Cordova plugins are deprecated. It's good to be aware of this, but if you limit yourself to plugins that are actively maintained, you are going to have a really hard time with Cordova. I recommend looking at the number of weekly downloads on npm: https://www.npmjs.com/package/cordova-plugin-filepath?activeTab=readme, which is currently +-3500, which is pretty good for a Cordova plugin. In the future you might get breaking changes (when you update cordova-android/ios or the targetSDK). But those you can patch with patch package.

That being said, we are transitioning to react-native, because of some features that we need, that are going to break in 2024, that we cannot repair.