-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Bug]: Custom Image Selector not identifing photo location #5015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting! Does sharing from Google Photos work? And what about from a third-party gallery app? Thanks! |
I don't have another phone easily available but I'll see what I can dig up. Sharing from Google Photos works without issue, but sharing from a third-party image gallery (Solid Explorer's "SE Image Viewer" in my case) has the same problem identifying image location. |
@sivaraam , would you mind trying to reproduce this issue on your OnePlus Nord? Checking whether image locations are identified when sharing photos from a third-party image gallery and/or using the Custom Photo Selector. |
From third-party gallery (Simple Gallery, by Simple Mobile Tools), I share to:
Screencast: https://youtu.be/-azE7U-lGgA Pixel 4, picture taken using stock camera Then when I share the same picture from the Google Photos app, the Commons app finds the location: |
Apologies. I somehow happened to miss the ping here.
Sure. I tried to check but I'm facing a somewhat weird situation. The app doesn't seem to be considering the location information in any of the images I try to upload i.e., I get the "No location found" pop-up in all cases though the image has location information in it. I tried to use regular upload option / custom image selector and sharing to the app from gallery app. All have consistent results. Not sure why this is happening. I don't remember it being like this before. I'm using v4.0.3.~23c474b06 on OnePlus Nord that runs Android 12. I've checked that the "Location" checkbox is turned on in the "Manage EXIF tags" setting. |
I would like to mention that I am also experiencing this issue on my Moto G50 running Android 12. Location works as expected on the "regular" selector but not the custom selector. |
I did some experiments using a picture that has location (proved by ExifViewer app). At Using the "normal" picker, at the same breakpoint, Both normal picker and custom picker go via receiveInternalSharedItems The intent is sent by methods called from onPictureReturnedFromCustomSelector whose Anyone willing to help: It could be interesting to check what happened in older versions of the app, in both custom and not (and maybe also in Android 8 where I did not observe this issue). |
https://commonsware.com/Q/pages/chap-location-002.html : "in Android 10, access to [EXIF location] is much more restricted than it had been." "only option appears to be to get the Uri for each individual image and use ExifInterface" |
On branch https://github.com/commons-app/apps-android-commons/tree/location-loss I did an experiment following https://developer.android.com/training/data-storage/shared/media#media-location-permission I added the ACCESS_MEDIA_LOCATION permission to the manifest. I also requested the permission at runtime as it is also required but no permission dialog is shown, apparently it is normal: https://stackoverflow.com/a/74288314/226958. Then in Any idea what I might be missing? |
I'm not absolutely sure but maybe you missed the following point mentioned in the article ?
|
@sivaraam you are right! I added We need to also try with the sharing intent and custom picker. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Hello @nicolas-raoul I had goon through this issue , all the helping sites that you have provided in this issue and some other Using ExifInterfaceIn the android media package inside the class with name "Classes" we have the class called ** ExifInterface getLatLong (float[] output) in the class ExifInterfaceUsing this method we can find the Geo location where the photo had been taken DemonstrationExifInterface exifdata = new ExifInterface(); // the function getLatLong ( array ) will return boolean value if Exif tags available it returns true else false if (haslocation) { I know java programming very well but I am new to android development . I love learning things by doing . I am very much interested in solving this issue. can I solve? for more clarity I would suggest to visit following sites : - Thank You |
@Keerthivardhan1 Thanks for the investigation! Feel free to modify the source code and try. i assign you to the issue, please let us know about your progress every few days. 🙂 |
sure |
So I skipped the process . so I started debugging .. these are the following takeaways .
These is the reason why its generating null pointer exception
that means : - > explorePlacesInfo.boundaryCoordinates is null right now I am unable to find where it should get updated ? but I will try to find it out . are there any suggestions ? |
@Keerthivardhan1 Make sure the device has internet access. And maybe try to use the prodDebug flavor. |
@Keerthivardhan1 Custom selector is highlighted in red in the issue description. To know how the execution paths differ, you will need to execute both in your Android IDE's debugger, and compare. |
Ok , Thanks a lot for giving me this idea @nicolas-raoul |
@nicolas-raoul I have quite some experience in building android apps with Kotlin/XML & Kotlin/Compose. I know java but haven't worked with java on an android project. I'm yet to go through the code but first wanted to test the app as a user. I'm in need of images with EXIF data containing location to test & observe the app's behavior. In the developer workflow guide the 5th point states that anyone can contact the mailing list to obtain good pictures. But I'm new to mailing lists and not sure how to do so. Can you provide me with forward guidance? How do I contact others via the mailing list? Edit: I obtained some sample images with EXIF GPS lat/long data from this repository & tested the app. The commons app detected location from pictures picked with the default file picker, built-in custom picker & also 3rd party apps (Realme Gallery app & Z archiver). But when I uploaded images with no location data, no prompt was shown asking me to enter the data manually. I've verified the location data of images with this app Test device Android Version |
@nicolas-raoul Can you review my PR? |
#5190) Co-authored-by: Siva <doodsiva@gmail.com>
GSoC applicants: While this issue was the most representative location loss issue, I suggest working on these ones instead: location-loss |
* feedback dialog: fix black font in dark mode * LocationPickerActivity: fix light map in dark mode * Fix #5182 Switch From Mapbox to MapLibre (#5184) * Fix #5182 Switch From Mapbox to MapLibre * Fix #5182 Switch From Mapbox to MapLibre - Resolved requestFeature() issue * Fix #5182 Switch From Mapbox to MapLibre - Resolved dark mode issue on two screens * Fix #5182 Switch From Mapbox to MapLibre - Resolved dark mode issue on additional screens * Fix #5182 Switch From Mapbox to MapLibre - Resolved dark mode issue on notification screen * Fix #5182 Switch From Mapbox to MapLibre - Test errors * fix issue #5015 - custom image selector not identifying photo location (#5190) Co-authored-by: Siva <doodsiva@gmail.com> * feedback dialog: fix black font in dark mode * LocationPickerActivity: fix light map in dark mode * LocationPicker: use predefined style based on device theme * LocationPickerActivityTest: add additional target exception in catch block * LocationPickerConstants: remove extra newline introduced --------- Co-authored-by: Kartikay Kaushik <93285364+kartikaykaushik14@users.noreply.github.com> Co-authored-by: Siva Subramaniam <112970189+siva-subramaniam-v@users.noreply.github.com> Co-authored-by: Siva <doodsiva@gmail.com>
Summary
The "custom picture selector" is not recognizing the locations from my photo's EXIF data. If I upload a photo using the regular file selctor, the app is able to identify the location of the photo from EXIF data. If I select the same photo with the custom selector, I get a "no location found" dialog box.
By "regular selector," I am referring to the button highlighted by a green box in the image below. "Custom selector" is in the red box.

(Not totally sure I have the name correct, but this is the feature I am referring to: #4764)
Steps to reproduce
Expected behaviour
Expected to identify location from EXIF data.
Actual behaviour
App indicates no location is found for the photo.
Device name
Google Pixel 4a
Android version
Android 12
Commons app version
4.0.1
Device logs
I didn't capture logs but can reproduce if they would be helpful.
Screen-shots
Image selected with custom picker does not identify location:

The same photo via the regular image selector identifies a location:
Would you like to work on the issue?
Prefer not
The text was updated successfully, but these errors were encountered: