coomar2841 / image-chooser-library

An Easy Image/Video Chooser Library for your Android Apps
646 stars 193 forks source link

Lollipop API 21: ImageChooserListener callback functions are not called? #53

Open Sharj opened 9 years ago

Sharj commented 9 years ago

I have used the library previously and It works like a charm.

Currently my application has targetSdkVersion 21 and testing application on Nexus 4 / 5.0.1 (API 21). I am calling pick photo from within a fragment like following

imageChooserManager = new ImageChooserManager(this, ChooserType.REQUEST_PICK_PICTURE); imageChooserManager.setImageChooserListener(this); imageChooserManager.choose();

after picking photo, I do get in onActivityResult and imageChooserManager.submit(requestCode, data) is called but I never get any error in log or callback to onImageChosen or onError. I have checked the content of data and I get correct URI of image from data.getData().toString().

After it didn't work, I tested the same application on Nexus 7/4.4/API 19 and It worked there. I see library is complied with targetSdkVersion 20. Are there any known issues with library working on API 21?

coomar2841 commented 9 years ago

Should work just fine with 21. Any logs? I am suspecting that you might not be logging some exceptions. Can you post some code snippets?

Sharj commented 9 years ago

It wasn't showing any error when checking adb logcat :E - Now I checked log with :D and it shows error (FileNotFoundException) and some other information:

I/ImageChooserManager(24758): File: content://com.android.providers.media.documents/document/image%3A120 I/MediaProcessorThread(24758): Directory size: 393556 I/ImageProcessorThread(24758): Processing Image File: content://com.android.providers.media.documents/document/image%3A120 I/MediaProcessorThread(24758): Image Uri: content://com.android.providers.media.documents/document/image%3A120 I/MediaProcessorThread(24758): Google photos Started I/MediaProcessorThread(24758): URI: content://com.android.providers.media.documents/document/image%3A120 I/MediaProcessorThread(24758): Extension: .jpg I/MediaProcessorThread(24758): Display Name: 1422058985060_fact_2.jpg I/MediaProcessorThread(24758): Size: 99659 W/System.err(24758): java.io.FileNotFoundException: No such file or directory W/System.err(24758): at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146) W/System.err(24758): at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:689) W/System.err(24758): at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1080) W/System.err(24758): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:921) W/System.err(24758): at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:778) W/System.err(24758): at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:733) W/System.err(24758): at com.kbeanie.imagechooser.threads.MediaProcessorThread.processGooglePhotosMedia(MediaProcessorThread.java:376) W/System.err(24758): at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:98) W/System.err(24758): at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:57) W/System.err(24758): java.io.FileNotFoundException: No such file or directory W/System.err(24758): at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146) W/System.err(24758): at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:689) W/System.err(24758): at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1080) W/System.err(24758): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:921) W/System.err(24758): at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:778) W/System.err(24758): at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:733) W/System.err(24758): at com.kbeanie.imagechooser.threads.MediaProcessorThread.processGooglePhotosMedia(MediaProcessorThread.java:376) W/System.err(24758): at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:98) W/System.err(24758): at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:57)

It is not able to find photo files that I have taken with camera and saved while It works fine with photos that I have saved from the internet. Any idea why it's not able to find files?

ozix commented 9 years ago

I have the same issue 2-12 11:50:20.128 30571-30571/com.com.com I/ImageChooserManager﹕ File: content://com.android.providers.media.documents/document/image%3A7465 02-12 11:50:20.134 30571-30571/com.com.com I/com.com.com.ui.drawer.DrawerFragment﹕ onresume 02-12 11:50:20.144 30571-30597/com.com.com V/GAV4﹕ Thread[GAThread,5,main]: Loaded clientId 02-12 11:50:20.148 30571-31382/com.com.com I/MediaProcessorThread﹕ Directory size: 39510001 02-12 11:50:20.151 30571-30618/com.com.com I/Adreno-EGL﹕ : QUALCOMM Build: 10/24/14, 167c270, I68fa98814b 02-12 11:50:20.151 30571-30618/com.com.com I/OpenGLRenderer﹕ Initialized EGL, version 1.4 02-12 11:50:20.159 30571-31382/com.com.com I/MediaProcessorThread﹕ Deleted 0 files 02-12 11:50:20.159 30571-31382/com.com.com I/ImageProcessorThread﹕ Processing Image File: content://com.android.providers.media.documents/document/image%3A7465 02-12 11:50:20.159 30571-31382/com.com.com I/MediaProcessorThread﹕ Image Uri: content://com.android.providers.media.documents/document/image%3A7465 02-12 11:50:20.159 30571-31382/com.com.com I/MediaProcessorThread﹕ Google photos Started 02-12 11:50:20.159 30571-31382/com.com.com I/MediaProcessorThread﹕ URI: content://com.android.providers.media.documents/document/image%3A7465 02-12 11:50:20.159 30571-31382/com.com.com I/MediaProcessorThread﹕ Extension: .jpg 02-12 11:50:20.164 30571-30597/com.com.com V/GAV4﹕ Thread[GAThread,5,main]: putHit called 02-12 11:50:20.164 30571-30597/com.com.com V/GAV4﹕ Thread[GAThread,5,main]: Sending hit to service PATH: https: PARAMS: sr=1080x1776, a=508336734, v=1, ht=1423738220134, an=ute, cd=com.com.com.ui.HomeActivity_, ul=pl-pl, t=screenview, _u=.3r398, tid=UA-57668548-2, cid=6342668f-345f-4f2d-ba6c-40aedb9c473d, aid=com.com.com, av=0.70-m-develop, 02-12 11:50:20.179 30571-31382/com.com.com I/MediaProcessorThread﹕ Display Name: 1422872550227_fact_1.jpg 02-12 11:50:20.179 30571-31382/com.com.com I/MediaProcessorThread﹕ Size: 245453 02-12 11:50:20.182 30571-30597/com.com.com V/GAV4﹕ Thread[GAThread,5,main]: Loaded clientId 02-12 11:50:20.182 30571-30597/com.com.com V/GAV4﹕ Thread[GAThread,5,main]: putHit called 02-12 11:50:20.182 30571-30597/com.com.com V/GAV4﹕ Thread[GAThread,5,main]: Sending hit to service PATH: https: PARAMS: sr=1080x1776, a=508336735, v=1, ht=1423738220134, an=ute, cd=uteUploadFragment, ul=pl-pl, t=screenview, _u=.K-AL, tid=UA-57668548-2, cid=6342668f-345f-4f2d-ba6c-40aedb9c473d, aid=com.com.com, av=0.70-m-develop, 02-12 11:50:20.195 30571-31382/com.com.com W/System.err﹕ java.io.FileNotFoundException: No such file or directory 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:689) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1080) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:921) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:778) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:733) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at com.kbeanie.imagechooser.threads.MediaProcessorThread.processGooglePhotosMedia(MediaProcessorThread.java:376) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:98) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:57) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ java.io.FileNotFoundException: No such file or directory 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:689) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1080) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:921) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:778) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:733) 02-12 11:50:20.210 30571-31382/com.com.com W/System.err﹕ at com.kbeanie.imagechooser.threads.MediaProcessorThread.processGooglePhotosMedia(MediaProcessorThread.java:376) 02-12 11:50:20.212 30571-31382/com.com.com W/System.err﹕ at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:98) 02-12 11:50:20.212 30571-31382/com.com.com W/System.err﹕ at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:57)

coomar2841 commented 9 years ago

Thanks for the logs. I would look into this soon.

darjidhruvit commented 9 years ago

any update for lollipop ? i get null every time when i picked up image from gallery or photos

Tictok91 commented 9 years ago

i get null after shooting a picture and press on Save. OnActivityResult I get data = null

cokeby190 commented 9 years ago

I have this issue too

coomar2841 commented 8 years ago

Are you saving the state, and reinitializing the chooser managers when the activity is destroyed? I am suspecting that is the issue here.

Tictok91 commented 8 years ago

what i can't understand is, why it works with some mobiles and with some no, with some of the mobiles i do not get a null, while with another i get a null...

On 28 September 2015 at 08:12, Kumar Bibek notifications@github.com wrote:

Are you saving the state, and reinitializing the chooser managers when the activity is destroyed? I am suspecting that is the issue here.

— Reply to this email directly or view it on GitHub https://github.com/coomar2841/image-chooser-library/issues/53#issuecomment-143649224 .

coomar2841 commented 8 years ago

This is because, if you activity gets killed, you will get a null value. So, it's important to save the states and reinitialize it when the activity is created again.

Tictok91 commented 8 years ago

this happens when selecting camera, when choosing image it always works..

On 28 September 2015 at 11:25, Kumar Bibek notifications@github.com wrote:

This is because, if you activity gets killed, you will get a null value. So, it's important to save the states and reinitialize it when the activity is created again.

— Reply to this email directly or view it on GitHub https://github.com/coomar2841/image-chooser-library/issues/53#issuecomment-143688989 .

coomar2841 commented 8 years ago

Sorry for being late. Is this still an issue? I am 100% sure that if you re-initialize the chooser managers, it should work for you. Please look at the sample app for the implementation.