Attaching a screenshot results in error with Samsung phones
Sometimes when using a Samsung phone, the app returns an error when attaching a screenshot as a photo. This appears to be a specific issue with the way Samsung's flavor of Android handles the naming of screenshots by adding the name of the app in the screenshot as a prefix to the photo. If the name of the app contains any spaces, the photo will fail to save to the app.
To reproduce the issue:
- Add a Survey point.
- Choose to add a photo from gallery.
- Switch to another app to make a screenshot.
- Make the screenshot.
- Switch back to Mergin Maps app.
- Select the screenshot which you just made.
- Try to save.
Adding a screenshot of 'Chrome' browser (works):
Adding a screenshot of 'Play Store' (fails):
In the diagnostic log, I see this when the photo attachment fails:
2025-10-15T16:28:32.033Z AppState: "Application changed state to:" Qt::ApplicationInactive
2025-10-15T16:28:32.895Z AppState: "Application changed state to:" Qt::ApplicationSuspended
2025-10-15T16:28:35.230Z Select image: Failed to copy image file to /storage/emulated/0/Android/data/uk.co.lutraconsulting/files/projects/1_photos/Screenshot_20251015_172650_Google%20Play%20Store.jpg
2025-10-15T16:28:35.280Z AppState: "Application changed state to:" Qt::ApplicationActive
2025-10-15T16:28:35.285Z Image Loading: Could not load the image. It may be missing or invalid, the URL might be incorrect, or there may be no network connection: /storage/emulated/0/Android/data/uk.co.lutraconsulting/files/projects/1_photos//Screenshot_20251015_172650_Google%20Play%20Store.jpg
Device: Samsung A53 Android (15.0) Mergin Maps v2025.5.0
You can find the builds to test here: https://github.com/MerginMaps/mobile/pull/4229#issuecomment-3579983601
Test reproduced on device: Samsung A53/Android (15.0) Mergin Maps Build: 733911
Steps to reproduce:
- Add a new feature (Survey layer).
- Choose to add a photo from gallery.
- Switch to another app (Play store) to make a screenshot.
- Make the screenshot from Play store.
- Switch back to Mergin Maps app.
- Select the screenshot which you made.
- Save the feature.
Actual Result: After taking a screenshot of the application (Play store) and attempting to add it from the gallery, the process fails. The application displays an error message: "Failed to process the image"
Comment: Despite the fact, that adding the screenshot of the application (Play store) from the gallery failed, this screenshot is uploaded into the QGIS.
Please, see video below:
https://github.com/user-attachments/assets/bb1f5446-66ed-40a1-b759-64b702bb7954