yasirkula / UnityNativeGallery

A native Unity plugin to interact with Gallery/Photos on Android & iOS (save and/or load images/videos)
MIT License
1.39k stars 199 forks source link

Gallery Browsing issues #85

Open karam89 opened 4 years ago

karam89 commented 4 years ago

Hello @yasirkula

Thank you very much for your great asset,

I've implemented your asset in my project and it works well,

I'm only having some issues browsing the pictures from my Gallery on Android

After calling the method GetImageFromGallery the Gallery gets opened like this

Screenshot_20191103-005929

And it seems to be heavily responding for a little time,

After 30 seconds the Albums gets appeared and becomes very well responsive as shown bellow

Screenshot_20191103-010037

but with some missing Albums (just like Camera album)

the missing Albums appears after switching to PICTURES tab, then back to ALBUMS tab, as shown bellow (Camera album has just appeared)

Screenshot_20191103-010405

Device: Samsung Note 5 Android Version: 6.0.1 Unity version: 2018.4.9 Scripting Backend: IL2CPP Scripting Runtime Version: .NET 4.x Write Permission: External Build System: Gradle Android Studio: 3.5

Any ideas?

Thanks in advanced

yasirkula commented 4 years ago

For testing purposes, can you try the example code on a new Unity project and see if it works fine: https://github.com/yasirkula/UnityNativeGallery#example-code

karam89 commented 4 years ago

I've created a new project, and added the code sample you provided

The same result did happen, as mentioned in the post above

Noting that the same build works well on other devices IE:

Note: This error only happens if I choose Gallery, while clicking Photos works like charm image

Thanks in advanced

yasirkula commented 4 years ago

Can you try inserting this code to your Start function and see if it changes anything:

using( AndroidJavaClass ajc = new AndroidJavaClass( "com.yasirkula.unity.NativeGalleryMediaPickerFragment" ) )
    ajc.SetStatic<bool>( "preferGetContent", true );
karam89 commented 4 years ago

I've added the given lines

After calling GetImageFromGallery the following UI did appear instantly and with good performance

Screenshot_20191104-194712

. . . . . . But if a chose to switch to Gallery, the same problem appears as mentioned in this post . . . .

Screenshot_20191104-194727

yasirkula commented 4 years ago

Thank you for all the details. I'm afraid I won't be able to resolve this issue in the foreseeable future since I can't reproduce it with the devices around me. Even if I managed to find a Note 5, I don't know which part of the code would cause this issue on only Note 5 devices' Gallery apps (issues that contain the word 'only' are super ugly, super annoying). I tried finding some answers on Google but couldn't really find any. Please let me know if you find any possible solutions to this problem or see any interesting error messages in logcat.

karam89 commented 4 years ago

I didn't say it only happens on Note 5, but this is the only case out of the 4 available devices for test I have

Anyway For testing purposes, I've added Unity Native Gallery asset, and Image and Video Picker on the same project

with 2 buttons, one for each asset to test getting an image from Gallery using different assets

as a result after building an apk:

Any ideas?

yasirkula commented 4 years ago

I won't be able to tell how the other paid plugin solves this issue but I'm glad the issue is resolved.

shacharoz commented 3 years ago

i would suggest to use whatever is working for you...

and let @yasirkula continue his great work ! 👍