darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 134 forks source link

Convert getIntent() resulted path to actual path #47

Closed maqeelqureshi closed 6 years ago

maqeelqureshi commented 6 years ago

Hello,

I needed to display shared images and save them in a separate folder but getIntent method was giving me uri. I have tried filePath.resolveNativePath() but this was throwing error.

getIntent() result "uri": "content://0@media/external/images/media/1185", "type": "image/png", "extension": "png"

In plugin I have added "getRealPathFromURI_API19" as per suggestions at https://stackoverflow.com/questions/2789276/android-get-real-path-by-uri-getpath/2790688.

"file://" + getRealPathFromURI_API19 working result /storage/emulated/0/DCIM/Camera/20180501_113549.jpg

darryncampbell commented 6 years ago

Hi, it's interesting. My first impression was this functionality should not belong in an intent plugin, it would be better to have the ability to convert uri to file path in a separate plugin but I do not see any other Cordova plugin that has this functionality. I will mark this with the todo label and add it to this plugin if I get some time. Thanks for the hint on where to find implementation.

darryncampbell commented 6 years ago

Published on npm as version 1.1.0.