Skip to content

Photo attachments via addAttachmentPhoto: which URI format does Locus expect so the image shows in the point info popup? #64

@HM404

Description

@HM404

Environment

  • locus-api-core / locus-api-android 0.9.72
  • Target device: Samsung, Android 13
  • 3rd-party add-on attaches images to points via GeoDataHelperKt.addAttachmentPhoto(point, uri, label) before sending through ActionDisplayPoints.sendPacks(...)

Expected

When the user taps a point on the map, Locus opens a small info popup. If the point has attached photos, the first one should appear as the preview image inside that popup.

What we observed

Depending on the URI string passed to addAttachmentPhoto, the preview never appears correctly — three failure modes:

URI we pass Preview image in popup
Raw absolute path /storage/emulated/0/Download/myApp/images/foo.jpg not recognized as image; shown as generic file in attachment list
file:///storage/emulated/0/Download/myApp/images/foo.jpg "!" warning icon where the image should be
content://<our FileProvider>/…/foo.jpg with grantUriPermission(...) to the Locus package "!" warning icon

Files are written to public Download/myApp/images/ via MediaStore.Downloads (Android 10+) or FileOutputStream on older devices. App has MANAGE_EXTERNAL_STORAGE declared but not granted.

Question

What URI format is addAttachmentPhoto designed to consume so Locus can render the image in the point info popup?

  • Is file:// still supported on Android 10+ / under scoped storage?
  • For content:// from an add-on's FileProvider, is a per-display grantUriPermission(...) sufficient, or does Locus need the provider exported="true" (because internal image loaders run in a context the grant doesn't cover)?
  • Are remote https:// URLs accepted, or must the add-on localize the image first?

A short contract note near addAttachmentPhoto in GeoDataHelper.kt — or a snippet in the sample — would be very helpful. Happy to contribute a PR once the expected format is clear.

Related

GeoDataHelper.addAttachmentPhotolocus-api-core/.../GeoDataHelper.kt#L376

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions