ground-android
ground-android copied to clipboard
[Data collection] First photo taken with camera doesn't appear
The first time a photo is taken, the user is prompted to go through the permissions flows. The camera appears, and the user can take photos, but upon taking a photo the user is not returned to the app. Presenting the back button returns the user to the add/edit observation form, but the photo(s) taken do not appear in the form.
To Reproduce
Steps to reproduce the behavior:
- Add a feature in a layer that uses photos, add an observation.
- Click "Add photo"
- Click through the permissions flow.
- Snap a photo
- Click "back" to return to form.
This only occurs the first time a photo is taken; subsequent attempts work.
Observed on various emulator versions.
Expected behavior The checkmark appears in the camera and the photo appears in the observation form.
Actual behavior The checkmark does not appear in the camera, and the photo doesn't appear when returning to the app.
@shobhitagarwal1612 Think you could take a look? 🙏
I can't reproduce it locally. Tried fresh installing the app, with and without airplane mode. Is it possible for you to provide a stack trace?
@shobhitagarwal1612 I didn't see anything relevant it the logs; no stack trace in Error log, no mentions of "camera" or "photo" at Verbose
Tested with build at commit 675415446a7041ee6b45a32db87465b85a5c2a1d on AS emulator with Pixel API 28:
- Create new or wipe data on existing AVD (Pixel API 28).
- Run app, sign in, select project with forms with photos.
- Add an observation to a feature in a layer with photos.
- Add a photo, go through permissions flow.
See repro here:

Thanks for the recording. In my flow, the location permission for camera app was never asked. Maybe that was the missing piece I was looking for. Thanks!
I can reproduce the error only if the camera app is opened for the first time (When "Remember photo locations?" dialog appears). It appears that the camera app forgets the capture intent because of the above dialog. Not sure what can be done to prevent this.
Confirmed there is an intent returned with the original request code, but the result code is 0 and the intent is null:
For posterity, the interstitial dialog contents are:
"Remember photo locations?" and "Tag your photos and videos with the locations where they're taken"

I see some physical devices online that use this dialog, so if we can't fix this we should at least show an error dialog when an error result code is returned.
@JSunde is this fixed given our recent changes? @shobhitagarwal1612 for additional context.
Yes I believe this is fixed with the recent permissions and photo task changes