nativescript-imagepicker icon indicating copy to clipboard operation
nativescript-imagepicker copied to clipboard

Selecting photos doesnt work on Android Q

Open davecoffin opened this issue 6 years ago • 18 comments

All latest...

Selecting a photo returns this error: Asset '/storage/emulated/0/DCIM/Camera/IMG_20190920_122446.jpg' cannot be found.

And doing something like this: var img = imageSourceModule.fromFile(selected.android.toString()); results in this error: Error: java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/IMG_20190920_122446.jpg: open failed: EACCES (Permission denied)

Does this have something to do with the new Scoped Storage Framework?

davecoffin avatar Sep 20 '19 16:09 davecoffin

Setting targetSdkVersion to 28 in app.gradle solves this for now. This plugin needs to be updated to use MediaStore, or will break for anyone targeting sdk 29

https://developer.android.com/reference/android/provider/MediaStore

davecoffin avatar Sep 20 '19 17:09 davecoffin

Hi @davecoffin ,

I've checked the demos in this repo and all of them works fine with the Android Q 10.0 (Api 29). Can you share a bit more details about the device/emulator you are using and a sample project where we can reproduce the mentioned issue.

DimitarTodorov avatar Sep 24 '19 10:09 DimitarTodorov

Closing due to inactivity

tbozhikov avatar Oct 15 '19 07:10 tbozhikov

For anybody that finds this, @dicksmith pointed this out:

Fun fact, if you want nativescript-imagepicker to work on Android 10, gotta target it (API 29) and add this to the application declaration in the manifest:

<application
  ...
    android:requestLegacyExternalStorage="true"
  ...
</application>

@DimitarTodorov is that what I was missing?

davecoffin avatar Nov 01 '19 17:11 davecoffin

I have the same issue and i am running it on a Xiaomi Mi 9 if that helps. Please reopen this issue, as I can confirm the bug. :(

flodaniel avatar Nov 11 '19 16:11 flodaniel

I have the same issue and i am running it on a Xiaomi Mi 9 if that helps. Please reopen this issue, as I can confirm the bug. :(

the above mentioned fix works on xiaomi mi 9

leo00723 avatar Nov 28 '19 17:11 leo00723

@leo00723 yes it works. but using legacy storage is not a fix but rather a work around

flodaniel avatar Dec 05 '19 11:12 flodaniel

Any updates on this? I have faced same issue...

vytautas-pranskunas- avatar Apr 07 '20 17:04 vytautas-pranskunas-

This issue still seems to be present.

bbroereES avatar Jun 17 '20 10:06 bbroereES

Still experiencing this issue

PhilippS93 avatar Jul 27 '20 09:07 PhilippS93

@PhilippS93 - Please see Dave's link above: https://github.com/NativeScript/nativescript-imagepicker/issues/309#issuecomment-548869313

This is something Google changed in Android which breaks functionality; to get the old functionality you need to tell it you want it...

NathanaelA avatar Jul 27 '20 13:07 NathanaelA

@PhilippS93 - Please see Dave's link above: #309 (comment)

This is something Google changed in Android which breaks functionality; to get the old functionality you need to tell it you want it...

Thank you. But this seems to be a temporary solution, right? The plugin needs to be adapted to use scoped storage in the future when targeting Android 11 or newer.

PhilippS93 avatar Jul 28 '20 06:07 PhilippS93

When can the updates be expected? Any other solutions to this problem?

Siergiej29 avatar Oct 20 '20 06:10 Siergiej29

any solution for this issue

skmani avatar Nov 02 '20 14:11 skmani

I think I have solved the problem. In app.gradle, just add: compileSdkVersion = 29

Siergiej29 avatar Nov 03 '20 07:11 Siergiej29

It's no longer allowed to use android:requestLegacyExternalStorage="true" if you're targeting Android 11. From May 5th, I think, we'll no longer be allowed to submit apps with this flag.

fpaaske avatar Apr 23 '21 07:04 fpaaske

any update on this issue for NS 6? we are not able to open see gallery images on android 11

itsmerockingagain avatar Jun 09 '21 03:06 itsmerockingagain

I think this plugin is deprecated and not longer supported in favor of https://github.com/NativeScript/plugins/tree/master/packages/imagepicker

PhilippS93 avatar Jun 09 '21 11:06 PhilippS93