package core:sys/android/native_app_glue

Warning: This was generated for -target:windows_amd64 and might not represent every target this package supports.

⌘K
Ctrl+K
or
/

    Types

    android_app ¶

    android_app :: struct {
    	userData:          rawptr,
    	onAppCmd:          proc(app: ^android_app, cmd: i32),
    	onInputEvent:      proc(app: ^android_app, event: ^android.AInputEvent) -> i32,
    	// Return 1 if the event was handled.
    	activity:          ^android.ANativeActivity,
    	// nil while a recreated activity is replaced (`APP_CMD_ACTIVITY_CHANGED`).
    	config:            ^android.AConfiguration,
    	// The state from the previous instance, if any. It must be allocated with `libc.malloc` (see `set_saved_state`).
    	savedState:        rawptr,
    	savedStateSize:    uint,
    	looper:            ^android.ALooper,
    	inputQueue:        ^android.AInputQueue,
    	window:            ^android.ANativeWindow,
    	contentRect:       android.ARect,
    	activityState:     i32,
    	// `APP_CMD_START`, `APP_CMD_RESUME`, `APP_CMD_PAUSE` or `APP_CMD_STOP`.
    	destroyRequested:  i32,
    	// Private to the glue.
    	mutex:             sync.Mutex,
    	cond:              sync.Cond,
    	msgread:           posix.FD,
    	msgwrite:          posix.FD,
    	cmdPollSource:     android_poll_source,
    	inputPollSource:   android_poll_source,
    	running:           bool,
    	stateSaved:        bool,
    	destroyed:         bool,
    	pendingInputQueue: ^android.AInputQueue,
    	pendingWindow:     ^android.ANativeWindow,
    	pendingActivity:   ^android.ANativeActivity,
    }

    Related Procedures With Parameters

    android_poll_source ¶

    android_poll_source :: struct {
    	id:      i32,
    	app:     ^android_app,
    	process: proc(app: ^android_app, source: ^android_poll_source),
    }
     

    The data pointer ALooper_pollOnce returns for LOOPER_ID_MAIN and LOOPER_ID_INPUT.

    Constants

    APP_CMD_ACTIVITY_CHANGED ¶

    APP_CMD_ACTIVITY_CHANGED :: 16
     

    activity is nil while a recreated activity goes, then the new one, with config.

    APP_CMD_CONFIG_CHANGED ¶

    APP_CMD_CONFIG_CHANGED :: 8
     

    config has been updated.

    APP_CMD_CONTENT_RECT_CHANGED ¶

    APP_CMD_CONTENT_RECT_CHANGED :: 5
     

    See contentRect.

    APP_CMD_DESTROY ¶

    APP_CMD_DESTROY :: 15
     

    destroyRequested is set. Return from main.

    APP_CMD_INIT_WINDOW ¶

    APP_CMD_INIT_WINDOW :: 1
     

    window is ready to use.

    APP_CMD_INPUT_CHANGED ¶

    APP_CMD_INPUT_CHANGED :: 0
     

    inputQueue changed.

    APP_CMD_SAVE_STATE ¶

    APP_CMD_SAVE_STATE :: 12
     

    Store state with set_saved_state before returning.

    APP_CMD_TERM_WINDOW ¶

    APP_CMD_TERM_WINDOW :: 2
     

    window is about to go away. It is still valid during the command.

    LOOPER_ID_INPUT ¶

    LOOPER_ID_INPUT :: 2
     

    Events from the input queue. The source is inputPollSource.

    LOOPER_ID_MAIN ¶

    LOOPER_ID_MAIN :: 1
     

    Commands from the activity. The source is cmdPollSource.

    LOOPER_ID_USER ¶

    LOOPER_ID_USER :: 3
     

    The first identifier free for the app's own file descriptors.

    ODIN_ANDROID_STDIO_TO_LOGCAT ¶

    ODIN_ANDROID_STDIO_TO_LOGCAT :: #config(ODIN_ANDROID_STDIO_TO_LOGCAT, true)
    -define:ODIN_ANDROID_STDIO_TO_LOGCAT=true
     

    Whether stdout and stderr go to logcat, tagged with the package name (see android.redirect_stdio_to_logcat). Build with -define:ODIN_ANDROID_STDIO_TO_LOGCAT=false to leave them at /dev/null.

    Variables

    This section is empty.

    Procedures

    ANativeActivity_onCreate ¶

    @(export)
    ANativeActivity_onCreate :: proc "c" (
    	activity:       ^android.ANativeActivity, 
    	savedState:     rawptr, 
    	savedStateSize: uint, 
    ) {…}

    android_app_post_exec_cmd ¶

    android_app_post_exec_cmd :: proc "contextless" (app: ^android_app, cmd: i8) {…}
     

    The glue's own handling of cmd, after onAppCmd.

    android_app_pre_exec_cmd ¶

    android_app_pre_exec_cmd :: proc "contextless" (app: ^android_app, cmd: i8) {…}
     

    The glue's own handling of cmd, before onAppCmd.

    android_app_read_cmd ¶

    android_app_read_cmd :: proc "contextless" (app: ^android_app) -> i8 {…}
     

    Read the next command from the activity. Returns -1 if none is waiting.

    app ¶

    app :: proc "contextless" () -> ^android_app {…}
     

    The app of the process, which main runs with. Activities come and go under it.

    set_saved_state ¶

    set_saved_state :: proc "contextless" (app: ^android_app, data: []u8) {…}
     

    Replace the saved state with a copy of data.

    Call it while handling APP_CMD_SAVE_STATE. The copy is allocated with libc.malloc because the activity frees it.

    Procedure Groups

    This section is empty.

    `#config` values

    Source Files

    Generation Information

    Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-31 23:54:16.590839100 +0000 UTC