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 130 forks source link

realPathFromUri #95

Closed akinzeman closed 4 years ago

akinzeman commented 4 years ago

I successfully get uri of clipItems, however, realPathFromUri function not works (neither success nor error functions thrown anything) do i miss sth?

intent = { "clipItems": [ { "uri": "content://0@media/external/images/media/56684", "type": "image/jpeg", "extension": "jpg" } ] }

var uri = intent.clipItems[0].uri; window.plugins.intentShim.realPathFromUri( uri, function (realPath) {
alert( realPath ); //not worked! } , function () { alert('Error realPath from media_uri'); } ); //also error not thrown!

darryncampbell commented 4 years ago

Is this on Android 10? I wonder if it could be related to scoped storage somehow.

akinzeman commented 4 years ago

Android 6.0.1

On Thu, Jan 23, 2020, 10:43 Darryn notifications@github.com wrote:

Is this on Android 10? I wonder if it could be related to scoped storage somehow.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/issues/95?email_source=notifications&email_token=AEM532HC2RZOG34JPEM7AI3Q7FDDPA5CNFSM4KKOQKM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJWMNBI#issuecomment-577554053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEM532CCAQAUYSH2WGOG3ITQ7FDDPANCNFSM4KKOQKMQ .

darryncampbell commented 4 years ago

There is a sample at https://github.com/darryncampbell/plugin-intent-api-exerciser/blob/master/www/js/index.js#L188. Did you grant READ_EXTERNAL_STORAGE permission? This function requires that permission.

HarelM commented 3 years ago

It this method unofficial? I didn't see it in the documentation or as part of Ionic wrapper.

darryncampbell commented 3 years ago

@HarelM this method was not documented due to laziness

Moving forward I'm concerned about the implications of Android scoped storage & I would probably have to rework this functionality for things like the media use case mentioned in this issue.

But, due to time constraints I am unlikely to make those kind of big changes at this stage.

HarelM commented 3 years ago

Thanks for getting back to me so quickly! Yes, I agree, I'm concerned about it too. I have switched my entire app usage to work with sharing of files created in memory instead of using the file system. I also migrated from open-with pluging that was handling my intents for this plugin to reduce complexity in iOS so I'm comparing the code there to stuff I need to do in js now. The only thing I wasn't getting right was getting an image name when I share an image with my app, so I'm guessing this method should do it, but I'm concerned about android 11 as well. Let me know if and how I can help.