crisp-sdk-android icon indicating copy to clipboard operation
crisp-sdk-android copied to clipboard

Selecting photo from gallery, not sending anything after selection

Open osman-teamswork opened this issue 3 years ago • 5 comments
trafficstars

When I select photo from Gallery, image is not sending. Screenshot attached.

Screenshot_20221026-084907_Files

Crisp SDK version - 1.0.13 OS Version: Android 12

osman-teamswork avatar Oct 26 '22 10:10 osman-teamswork

Hi @osman-teamswork and thank you for your feedback.

Could you please attach me the logs from the moment you have selected the picture?

I have already encoutered this kind of issue on previous projects with Samsung or Google Photos when, despite specifying Intent.EXTRA_LOCAL_ONLY to filter only local files to avoid writing an implementation for every service in the world to download the selected content, it does not care at all and display all of its content, even if the requesting app could not access it directly...

Doc1faux avatar Oct 27 '22 12:10 Doc1faux

Here is the logs you asked- log.txt

osman-teamswork avatar Oct 27 '22 13:10 osman-teamswork

Unfortunately, Your logs does not helped me :/

I tried to reproduce it on my own with Google Photos & Drive apps. With the Intent.EXTRA_LOCAL_ONLY option, select a photo from both apps returns an Activity.RESULT_CANCELED result, which I suppose is intended to avoid returning remote files. However, without this option, apps behave differently... While Google Photos is still returning an Activity.RESULT_CANCELED result, Google Drive returns an Activity.RESULT_OK result with a content URI content://com.google.android.apps.docs.storage/document/ID and surprisingly, the SDK handled it well via the ContentResolver and uploaded the photo!

So maybe I should remove the local filter after all :) Unfortunately, if your case fall into the same as Google Photos, i.e. returning an Activity.RESULT_CANCELED as if the user were hitting the back button, I can't handle it differently :/

Doc1faux avatar Oct 27 '22 17:10 Doc1faux

Google Photos stores both local and remote pictures and because of that is registered for that intent with that extra. However apparently it ignores wherever calling intent has EXTRA_LOCAL_ONLY set true. If the gallery app does not support the above intent, you can show an error message to the user after checking the file length of the returned file path from gallery app.

osman-teamswork avatar Nov 03 '22 08:11 osman-teamswork

Finally, I think I found the issue! I like when docs are not up-to-date at Google (:

Starting the intent via Intent.createChooser(intent, title) instead of just the intent itself resolved the issue and now both Google Photos & Drive apps return me an Activity.RESULT_OK with a content URI which can be used by the SDK! So bye EXTRA_LOCAL_ONLY filter :)

It will be available in the next 1.0.14 release. I will let you know when it will be published ;)

Doc1faux avatar Nov 03 '22 09:11 Doc1faux

@osman-teamswork 1.0.14 implementing this feature has just been released. It can take a few hours before it will be available. I close the issue.

Doc1faux avatar Dec 29 '22 17:12 Doc1faux