Platform (Android, iOS, Website):
Android
App version number, if a mobile app issue (shown under Settings or About):
1.26.11 (541)
Browser, if a website issue (Firefox, Chrome, etc) :
n/a
URLs (aka web addresses) of any relevant observations or pages:
n/a
Screenshots of what you are seeing (instructions for taking a screenshot on computers and mobile devices: https://www.take-a-screenshot.org/):
n/a
Description of problem (please provide a set of steps we can use to replicate the issue, and make as many as you need.):
Giving permission for “Files an media” is required to let the location be acquired using the phone’s GPC.
To reproduce failing GPS…
- Allow permissions “Camera”, “Location”
- Don’t allow permissions “Contacts”, “Files and media”, “Microphone”
- Create a new observation with “no media”
- Observe that the location is not set.
- Attempt to set the location manually and observe the long/lat are set to 0,0, the “my location” symbol does nothing.
To reproduce successfully GPS…
- Allow permissions “Camera”, “Location”, "Files and media"
- Don’t allow permissions “Contacts”, “Microphone”
- Create a new observation with “no media”
- Observe that the location is set automatically.
I’m guessing this is the offending code:
https://github.com/inaturalist/iNaturalistAndroid/blob/29fdcb90da8111697a0273c5961506616b5ebee5/iNaturalist/src/main/java/org/inaturalist/android/INaturalistApp.java#L1243
A rough fix might be to simply remove this line:
https://github.com/inaturalist/iNaturalistAndroid/blob/29fdcb90da8111697a0273c5961506616b5ebee5/iNaturalist/src/main/java/org/inaturalist/android/LocationChooserActivity.java#L239
I know next to nothing about android development, so I can’t say what the implications of such a change would be.
I’ll speculate about android permissions, assume everything I’m saying is wrong…
The permission ACCESS_MEDIA_LOCATION is used to grab location metadata off of media that’s otherwise stripped before being accessed to the app. I would guess that this permission check should be skipped, except when uploading photos from the device.
Curiously, there’s a permission called READ_EXTERNAL_STORAGE, which does not appear in the app manifest. I guess that means that “Files and media” in the UI is activated exclusively to obtain the file metadata and uploading files goes through a flow that doesn’t require permissions (neat!)
I’d be happy to research android permissions further, if folks would find it useful, but perhaps the devs have some immediate expertise here.