Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Fix GPX file picker on Android 13+ and transport selection bug#450

Open
betodealmeida wants to merge 1 commit intoIndiePass:masterfrom
betodealmeida:fix-gpx-file-picker-android13
Open

Fix GPX file picker on Android 13+ and transport selection bug#450
betodealmeida wants to merge 1 commit intoIndiePass:masterfrom
betodealmeida:fix-gpx-file-picker-android13

Conversation

@betodealmeida
Copy link

Summary

  • Fix GPX file selection on Android 13+ by using ACTION_OPEN_DOCUMENT without restrictive MIME type filters
  • Add file extension validation to ensure only .gpx files are accepted
  • Fix transport spinner bug that was causing errors when selecting a transport mode

Problem

On Android 13+, GPX files were visible in the file picker but could not be selected. This was because:

  1. The previous implementation used Intent.createChooser() which interferes with the Storage Access Framework
  2. GPX files may have various MIME types (application/gpx+xml, application/octet-stream, text/xml, etc.) that didn't match the filter

Additionally, selecting a transport mode (Boat, Walk, etc.) caused an error due to a typo using read.getSelectedItemPosition() instead of transport.getSelectedItemPosition().

Changes

  • Use ACTION_OPEN_DOCUMENT with CATEGORY_OPENABLE and proper permission flags
  • Remove MIME type restrictions (GPX files have inconsistent MIME types across devices)
  • Add isGpxFile() method to validate file extension after selection
  • Add trip_invalid_file_type string resource for user-friendly error message
  • Fix transport spinner variable name typo

Test plan

  • Create a Trip post on Android 13+ device
  • Tap "Load GPX" and verify GPX files are selectable
  • Verify non-GPX files show "Please select a GPX file (.gpx)" error
  • Select a transport mode and verify the Trip posts successfully

- Use ACTION_OPEN_DOCUMENT without MIME type restrictions for GPX files
  since they may have various MIME types (application/gpx+xml,
  application/octet-stream, text/xml, etc.)
- Add CATEGORY_OPENABLE and permission flags for proper SAF handling
- Validate file extension after selection to ensure .gpx files only
- Fix transport spinner bug: was using 'read' instead of 'transport'

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant