android_app

#include <android_native_app_glue.h>

This is the interface for the standard glue code of a threaded application.

Summary

In this model, the application's code is running in its own thread separate from the main thread of the process. It is not required that this thread be associated with the Java VM, although it will need to be in order to make JNI calls any Java objects.

Public attributes

activity
The GameActivity object instance that this app is running in.
activityState
int
Current state of the app's activity.
config
AConfiguration *
The current configuration the app is running in.
contentRect
ARect
Current content rectangle of the window; this is the area where the window's content should be placed to be seen by the user.
currentInputBuffer
int
destroyRequested
int
This is non-zero when the application's GameActivity is being destroyed and waiting for the app thread to complete.
inputBuffers[NATIVE_APP_GLUE_MAX_INPUT_BUFFERS]
This is used for buffering input from GameActivity.
looper
ALooper *
The ALooper associated with the app's thread.
onAppCmd)(struct android_app *app, int32_t cmd)
void(*
A required callback for processing main app commands (APP_CMD_*).
savedState
void *
The last activity saved state, as provided at creation time.
savedStateSize
size_t
The size of the activity saved state.
textInputState
int
0 if no text input event is outstanding, 1 if it is.
userData
void *
An optional pointer to application-defined state.
window
ANativeWindow *
When non-NULL, this is the window surface that the app can draw in.

Public attributes

activity

GameActivity * android_app::activity

The GameActivity object instance that this app is running in.

activityState

int android_app::activityState

Current state of the app's activity.

May be either APP_CMD_START, APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP.

config

AConfiguration * android_app::config

The current configuration the app is running in.

contentRect

ARect android_app::contentRect

Current content rectangle of the window; this is the area where the window's content should be placed to be seen by the user.

currentInputBuffer

int android_app::currentInputBuffer

destroyRequested

int android_app::destroyRequested

This is non-zero when the application's GameActivity is being destroyed and waiting for the app thread to complete.

inputBuffers

struct android_input_buffer android_app::inputBuffers[NATIVE_APP_GLUE_MAX_INPUT_BUFFERS]

This is used for buffering input from GameActivity.

Once ready, the application thread switches the buffers and processes what was accumulated.

looper

ALooper * android_app::looper

The ALooper associated with the app's thread.

onAppCmd

void(* android_app::onAppCmd)(struct android_app *app, int32_t cmd)

A required callback for processing main app commands (APP_CMD_*).

This is called each frame if there are app commands that need processing.

savedState

void * android_app::savedState

The last activity saved state, as provided at creation time.

It is NULL if there was no state. You can use this as you need; the memory will remain around until you call android_app_exec_cmd() for APP_CMD_RESUME, at which point it will be freed and savedState set to NULL. These variables should only be changed when processing a APP_CMD_SAVE_STATE, at which point they will be initialized to NULL and you can malloc your state and place the information here. In that case the memory will be freed for you later.

savedStateSize

size_t android_app::savedStateSize

The size of the activity saved state.

It is 0 if savedState is NULL.

textInputState

int android_app::textInputState

0 if no text input event is outstanding, 1 if it is.

Use GameActivity_getTextInputState to get information about the text entered by the user.

userData

void * android_app::userData

An optional pointer to application-defined state.

window

ANativeWindow * android_app::window

When non-NULL, this is the window surface that the app can draw in.