Android Storage Access Framework (SAF) integration plus content:// URI
support. Use this to import/export user files through the native document
picker (ACTION_OPEN_DOCUMENT, ACTION_CREATE_DOCUMENT,
ACTION_OPEN_DOCUMENT_TREE).
Picker results arrive through onResult with the document URI, display
name and (for open requests) the file contents.
Public fields
| Name | Type | Static | Default | Notes |
|---|
REQUEST_OPEN_DOCUMENT | Int | yes | 9101 | final · Request codes, mirrored from PhoenixStorage.java. |
REQUEST_CREATE_DOCUMENT | Int | yes | 9102 | final |
REQUEST_OPEN_DOCUMENT_TREE | Int | yes | 9103 | final |
onResult | FlxTypedSignal<AndroidStorageResult->Void> | yes | — | property (get, never) · Fired with every picker result (including cancellation). |
Public methods
openDocument
static function openDocument(?mimeTypes:String, ?title:String):Void
Opens the native document picker.
@param mimeTypes comma separated MIME types, e.g. "application/json"
(empty/null = any type).
| Parameter | Type | Default |
|---|
mimeTypes (optional) | String | — |
title (optional) | String | — |
View source
openDocumentByExtensions
static function openDocumentByExtensions(extensions:Array<String>, ?title:String):Void
Convenience wrapper for openDocument with a list of extensions mapped to MIME types.
| Parameter | Type | Default |
|---|
extensions | Array<String> | — |
title (optional) | String | — |
View source
createDocument
static function createDocument(mime:String, suggestedName:String):Void
Opens the native "create file" picker (save-as).
| Parameter | Type | Default |
|---|
mime | String | — |
suggestedName | String | — |
View source
openDocumentTree
static function openDocumentTree():Void
Opens the native directory picker.
View source
isContentUri
static function isContentUri(uri:String):Bool
| Parameter | Type | Default |
|---|
uri | String | — |
View source
readUriBytes
static function readUriBytes(uri:String):Null<Bytes>
Reads a content:// URI into memory.
| Parameter | Type | Default |
|---|
uri | String | — |
View source
readUriText
static function readUriText(uri:String):Null<String>
Reads a content:// URI as UTF-8 text.
| Parameter | Type | Default |
|---|
uri | String | — |
View source
writeUriBytes
static function writeUriBytes(uri:String, data:Bytes):Bool
Writes bytes to a content:// URI previously returned by createDocument.
| Parameter | Type | Default |
|---|
uri | String | — |
data | Bytes | — |
View source
writeUriText
static function writeUriText(uri:String, text:String):Bool
| Parameter | Type | Default |
|---|
uri | String | — |
text | String | — |
View source
getDisplayName
static function getDisplayName(uri:String):String
Display name of a content:// (or file) URI, "" when unknown.
| Parameter | Type | Default |
|---|
uri | String | — |
View source
getUriSize
static function getUriSize(uri:String):Int
Size in bytes of a content:// (or file) URI, -1 when unknown.
| Parameter | Type | Default |
|---|
uri | String | — |
View source
importUri
static function importUri(uri:String, destinationPath:String):Null<String>
Copies a content:// URI into the app's storage directory so it can be
used through regular filesystem paths. Returns the destination path or
null on failure.
| Parameter | Type | Default |
|---|
uri | String | — |
destinationPath | String | — |
View source
exportFileToUri
static function exportFileToUri(filePath:String, uri:String):Bool
Copies a regular file into a content:// URI (for export flows).
| Parameter | Type | Default |
|---|
filePath | String | — |
uri | String | — |
View source
persistUriPermission
static function persistUriPermission(uri:String, writable:Bool = true):Void
Persists read/write permission grants for a picked URI across reboots.
| Parameter | Type | Default |
|---|
uri | String | — |
writable (optional) | Bool | true |
View source
extensionToMime
static function extensionToMime(extension:String):Null<String>
Maps common file extensions to MIME types.
| Parameter | Type | Default |
|---|
extension | String | — |
View source
Internals
Private / internal members
| Field | Type | Static |
|---|
_openDocument | Dynamic | yes |
_createDocument | Dynamic | yes |
_openDocumentTree | Dynamic | yes |
_readUriBytes | Dynamic | yes |
_writeUriBytes | Dynamic | yes |
_getDisplayName | Dynamic | yes |
_getUriSize | Dynamic | yes |
_copyUriToFile | Dynamic | yes |
_persistUriPermission | Dynamic | yes |
| Method |
|---|
static inline function get_onResult():FlxTypedSignal<AndroidStorageResult->Void> |
static function openDocument_jni(mimeTypes:String, title:String):Void |
static function createDocument_jni(mime:String, name:String):Void |
static function openDocumentTree_jni():Void |
static function readUriBytes_jni(uri:String):Dynamic |
static function writeUriBytes_jni(uri:String, data:Dynamic):Bool |
static function getDisplayName_jni(uri:String):String |
static function getUriSize_jni(uri:String):Float |
static function copyUriToFile_jni(uri:String, destination:String):Bool |
static function persistUriPermission_jni(uri:String, writable:Bool):Void |