CodeName OneShai Almog4 min readintermediate
Put App Documents in the System File Browser
Summary
Codename One adds a read‑only DocumentProvider API that lets apps publish a virtual file tree to iOS Files and Android’s storage picker. The tree is defined with `DocumentNode` objects, can include remote‑only entries, and is shared via an App Group container. The iOS extension runs in a separate process, so the model is serialized and read independently; Android uses the same model inside the ap…
- Use `DocumentProvider.publish(root)` to expose a curated, read‑only document hierarchy to the system file browsers.
- Nodes can be local (`setPath`) or remote (`setRemoteId`); remote fetches use a token‑based endpoint defined via `DocumentProvider.setRemoteEndpoint`.
- The iOS File Provider extension reads a serialized index from an App Group container; the app can terminate after publishing.
- Updates require republishing a new tree; clearing with `DocumentProvider.clear()` removes the location (e.g., on logout).
Exposes in‑app documents to the native file ecosystem without giving the app full filesystem access, improving user workflow (preview/share) while keeping a tight security boundary. The remote‑node support enables on‑demand fetching, useful for cloud‑backed storage scenarios.
6/10