Skip to content

fix(mobile): build a standard geo: URI for external map apps on Android - #1135

Open
Deeds67 wants to merge 1 commit into
mainfrom
fix/1087-android-geo-uri
Open

Deeds67 wants to merge 1 commit into
mainfrom
fix/1087-android-geo-uri

Conversation

@Deeds67

@Deeds67 Deeds67 commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1087.

Problem

Tapping the map in the asset detail panel on Android launched geo://lat,lng?z=16&q=lat%2Clng. It was built with Uri(scheme: 'geo', host: ...), which adds a // authority and percent-encodes the comma in q. Google Maps accepts that, but Baidu Maps reads q as search text and Amap fails to open the location.

Change

  • New pure helper mobile/lib/utils/geo_uri.dart → geo:lat,lng?q=lat,lng&z=16 (the RFC 5870 / Android intent form).
  • exif_map.dart uses it. iOS and the OpenStreetMap fallback are unchanged.

Testing

  • mobile/test/utils/geo_uri_test.dart: checks the exact string, negative coordinates, and parse-back (no authority, literal comma).
  • Confirmed the test fails against the old construction (Actual: 'geo://31.2304,121.4737?z=16&q=31.2304%2C121.4737').
  • dart analyze --fatal-infos and dart format are clean on the touched files.

Not covered

  • Not tested on a device with Amap or Baidu installed. The fix makes the URI match the standard form both apps document; it has not been checked end to end.
  • Chinese map apps use GCJ-02 / BD-09 coordinates, while EXIF GPS is WGS-84, so the pin may land a few hundred metres off inside mainland China. That is a separate issue and is not addressed here.

The map-tap handler built the Android intent with Uri(scheme: 'geo', host: ...),
which serialises as geo://lat,lng?z=16&q=lat%2Clng. Google Maps tolerates the
'//' authority and the encoded comma, but Baidu Maps treats q as search text
and Amap fails to open the location.

Build geo:lat,lng?q=lat,lng&z=16 (RFC 5870 / Android intent form) instead,
via a small pure helper so the exact string is unit-tested.

Fixes #1087
@Deeds67 Deeds67 added the changelog:fix Bug fix for changelog label Sep 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:fix Bug fix for changelog 📱mobile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: Opening photo location in Amap or Baidu Maps does not work correctly

1 participant