Skip to content

Conversation

@glastonbridge
Copy link
Collaborator

@glastonbridge glastonbridge commented Dec 19, 2025

Currently WIP but writing all this down so it's not lost in the new year...

Supported approaches to loading hex files on Android and iOS

  • ✅ via the open button in the app (same as web)
  • ✅ via the OPEN intent / filehandler (android / ios respectively)
  • ✅ via share flow (recommended for maximum compatibility with other apps)

Sharing

In both android and iOS, sharing is handled by a separate activity / share target, which is tied to the lifecycle of the calling app. It needs to transfer the data it needs to its own files area (file access control is not shared outside of the share handler), then launch the main CreateAI Capacitor App. The share target activity will cease to exist once the share flow is completed, and the main CreateAI app has a different process lifecycle.

Android

On android, ShareReceiverActivity is opened whenever a hex file is shared, copies the file into the app's area, and it launches the MainAcitivity using a private intent containing the local URL.

Note that Android share operations often mangle the file information, so we cannot filter for files named ".hex" in a useful way. Instead, this uses a combination of application/octet-stream mime type, and a hope that the MakeCode importer will correctly bounce erroneous files. It seems to.

iOS

The CreateAI Share Target is opened whenever someone hits the "Post" button, and it also takes a copy of the file, which it stores in an App Group. The path to the file in the app group is then used as a local private URL with which the main app is launched.

TODO: I span up a debug App Group locally, but the foundation is going to need to create one under its own account and correctly label it in the plist. (See Note below)

TODO: needs to filter on file extensions.

Note for next year

Alex needs adding to the Foundation's iOS developer team, so they can use the org.microbit.createai app ID and also create an app group. I've been hacking in a development App Group IDs using my own account for now, but this is not available to others on the team.

@github-actions
Copy link

Preview build will be at
https://review-createai.microbit.org/apps-load-hex/

@glastonbridge glastonbridge changed the base branch from main to apps December 19, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants