jibon57 / nativescript-mediafilepicker

A complete file picker solution for NativeScript
Apache License 2.0
51 stars 39 forks source link

The Image Gallery is not showing any images on Android 10 (API 29) #102

Open nafre opened 4 years ago

nafre commented 4 years ago

Describe the bug On Android 10 (API 29), I ran the demo from this repo and the results for the ImagePicker is as shown in the picture below. I have provided the app with all the permissions needed. Screenshot_20200221-151310_demo As you can see, the images are not showing up.

To Reproduce Steps to reproduce the behavior: Try running this plugin on Samsung 10 or API level 29

Expected behavior The application should work as it should by showing the gallery and the camera as well.

NativeScript Info(please run tns info):

tns info
√ Getting NativeScript components versions information...
‼ Update available for component nativescript. Your current version is 6.1.2 and the latest available version is 6.4.0.
‼ Update available for component tns-core-modules. Your current version is 6.1.2 and the latest available version is 6.4.1.
‼ Update available for component tns-android. Your current version is 6.1.1 and the latest available version is 6.4.1.
‼ Update available for component tns-ios. Your current version is 6.1.1 and the latest available version is 6.4.2.

Sample Code(please provide minimum code to reproduce problem): The code is from the demo which can be found in this repository.

jibon57 commented 4 years ago

@nafre Have you tried to add android:requestLegacyExternalStorage="true" ?

<application
        android:name="com.tns.NativeScriptApplication"
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:requestLegacyExternalStorage="true">
nafre commented 4 years ago

I just tried the method above and it worked. Thanks.

hugops commented 4 years ago

Hi, I had problems doing this procedure. The images are displayed, but when I try to record a video this error appears.

System.err: An uncaught Exception occurred on "main" thread. System.err: MIME type video/mp4 cannot be inserted into content://media/external/images/media; expected MIME type under image/* System.err: System.err: StackTrace: System.err: java.lang.IllegalArgumentException: MIME type video/mp4 cannot be inserted into content://media/external/images/media; expected MIME type under image/* System.err: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:170) System.err: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140) System.err: at android.content.ContentProviderProxy.insert(ContentProviderNative.java:481) System.err: at android.content.ContentResolver.insert(ContentResolver.java:1835) System.err: at com.vincent.filepicker.adapter.VideoPickAdapter$1.onClick(VideoPickAdapter.java:96) System.err: at android.view.View.performClick(View.java:7870) System.err: at android.view.View.performClickInternal(View.java:7839) System.err: at android.view.View.access$3600(View.java:886) System.err: at android.view.View$PerformClick.run(View.java:29363) System.err: at android.os.Handler.handleCallback(Handler.java:883) System.err: at android.os.Handler.dispatchMessage(Handler.java:100) System.err: at android.os.Looper.loop(Looper.java:237) System.err: at android.app.ActivityThread.main(ActivityThread.java:7857) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)

if remove android:requestLegacyExternalStorage="true" I can open the video recorder, but the images do not showing

mreall commented 4 years ago

I'm having the same problem as @hugops. Has anyone figured out a workaround?

hugops commented 4 years ago

I fork the android project https://github.com/hugops/MultiType-FilePicker, and fixed the bugs. After i generate the aar lib and replace the file in node-modules path (node_modules/nativescript-mediafilepicker/platforms/android/MultiTypeFilePicker-release.aar) to work in my project

xpalacincreditoh commented 3 years ago

But in android 11 sdk 30 not works

meightythree commented 3 years ago

Android 11 SDK 30 still does not list files in Documents or Downloads folder.

Name: pixel_5_api_30 CPU/ABI: Google APIs Intel Atom (x86) Path: C:\Users\user.android\avd\Pixel_5_API_30.avd Target: google_apis [Google APIs] (API level 30) image.androidVersion.api: 30

xpalacincreditoh commented 2 years ago

I have the same error with SDK 30