# Game Activity

`#include <GameActivity.h>`

The interface to use [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity).

## Summary

| ### Enumerations ||
|---|---|
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga3f63ac483c4086820828eb2584f1b17c{ https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gga3f63ac483c4086820828eb2584f1b17ca800baa22c39c9b0f6c39f712c51b65d3 = 0x0001, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gga3f63ac483c4086820828eb2584f1b17ca10cb354e0dc56713b651b81de255a626 = 0x0002 }` | enumFlags for GameActivity_hideSoftInput; see the Java InputMethodManager API for documentation. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gab2bf2fc256437ff71275ac1c8aa2cf7e{ https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea801b78bd90914d7df5e618dd0d347e06 = 0x00000001, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea957d6e529ecb9cc43eab69c43a1b5ae4 = 0x00000002, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eae6d563e0ab2c639ba64455fe8b797151 = 0x00000004, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea107475b076db2a03a4f39d0ff7d089b0 = 0x00000008, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea746124d8976926b0fefdd6a49a4e7634 = 0x00000010, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea444dc3f1b07b2893729a0762a1b0a2c3 = 0x00000020, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea5e93434a3316e977e270278c6d196908 = 0x00000040, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea1c9ed3c6d377c83f38634003addcf65f = 0x00000080, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea147849279b726a081530b382dfc79076 = 0x00000100, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea3cfef5cb117909da9a32399063afd786 = 0x00000200, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea588d2583d33666ba970ed63a50088324 = 0x00000400, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea1b86e6056dc260841f70a67d75fa5784 = 0x00000800, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea9f3125e4f7e4c5e9f104f392df22bb78 = 0x00001000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eafe797a70b8782a5730b2215f85f9b268 = 0x00002000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea91050ca5beac86dfe6365b500af731cc = 0x00004000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eae8a7ec8bd6b5bc1c467269d80076b05f = 0x00008000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eaca973eb98a4fa1d4d6a600271b86c863 = 0x00010000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eaee40166acdb7d0117d6edd8a5133aafa = 0x00020000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eabaef983b28579ad2a18558ee566c74c0 = 0x00040000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eaf85357e08ab4c0f98432e866a9929325 = 0x00080000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea0e1553655ba986e87ba61d87d19adaa2 = 0x00100000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea898cb23e6b73ec0b022f8e2bdf5b9951 = 0x00200000, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea5de8c9533eb3822bf81ed0f6f14f62aa = 0x00400000 }` | enumFlags for GameActivity_setWindowFlags, as per the Java API at android.view.WindowManager.LayoutParams. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga622c06202cfa7ee8b107cdbe1a4bad20{ https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gga622c06202cfa7ee8b107cdbe1a4bad20a2f56db6a5eb2ac65e694e4bc61d54391 = 0x0001, https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gga622c06202cfa7ee8b107cdbe1a4bad20a3b3f37b972ff58ceb83fedf1aebeb3be = 0x0002 }` | enumFlags for GameActivity_showSoftInput; see the Java InputMethodManager API for documentation. |

| ### Typedefs ||
|---|---|
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gab5e84c697dfa011eccda60707df43e65` | typedef `struct https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity` This structure defines the native side of an android.app.GameActivity. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga4b585b44a62ed6e43a4ea154976ce9f3` | typedef `struct https://developer.android.com/reference/games/game-activity/struct/game-activity-callbacks#struct_game_activity_callbacks` These are the callbacks the framework makes into a native application. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga374425d75b74cc77ee9362634d4ae1c4` | typedef `struct https://developer.android.com/reference/games/game-activity/struct/game-activity-key-event#struct_game_activity_key_event` Describe a key event that happened on the [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity) SurfaceView. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga53c4793e19a18101962aebe4c7210e90` | typedef `struct https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event#struct_game_activity_motion_event` Describe a motion event that happened on the [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity) SurfaceView. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gace21362dd27cceb05f30e22923e50690` | typedef `struct https://developer.android.com/reference/games/game-activity/struct/game-activity-pointer-axes#struct_game_activity_pointer_axes` Describe information about a pointer, found in a [GameActivityMotionEvent](https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event#struct_game_activity_motion_event). |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gab14431a58b817234917d05ab8d3a3575(GameActivity *activity, void *savedState, size_t savedStateSize)` | typedef `void` This is the function that must be in the native code to instantiate the application's native activity. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gaf906997d435c73162b94dee70b4b374e)(const char *bytes, int len, void *context)` | typedef `void(*` A function the user should call from their callback with the data, its length and the library- supplied context. |

| ### Variables ||
|---|---|
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga7cfd6f5be9923ffd22becd445ef78428` | `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gab14431a58b817234917d05ab8d3a3575` The name of the function that NativeInstance looks for when launching its native code. |

| ### Functions ||
|---|---|
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga12f84de1ee7f57b172174ed8098add95(JNIEnv *env, jobject motionEvent, https://developer.android.com/reference/games/game-activity/struct/game-activity-key-event#struct_game_activity_key_event *out_event)` | `void` Convert a Java `KeyEvent` to a `https://developer.android.com/reference/games/game-activity/struct/game-activity-key-event#struct_game_activity_key_event`. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gaec30f1e5c3803df7f9971c3061ec3e2d(JNIEnv *env, jobject motionEvent, https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event#struct_game_activity_motion_event *out_event)` | `void` Convert a Java `MotionEvent` to a `https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event#struct_game_activity_motion_event`. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga4cbb16cb5dcd37cf580b6038454793c8(int32_t axis)` | `void` Disable the specified axis. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gab1cc236d83c32a82e431b58f43cfd1af(int32_t axis)` | `void` Enable the specified axis, so that its value is reported in the [GameActivityPointerAxes](https://developer.android.com/reference/games/game-activity/struct/game-activity-pointer-axes#struct_game_activity_pointer_axes) structures stored in a motion event. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gafeb729f1350ded46b295639111921cba(https://developer.android.com/reference/games/game-activity/struct/game-activity-pointer-axes#struct_game_activity_pointer_axes *pointerInfo, int32_t axis)` | `float` Get the value of the requested axis. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga3d08d0316b7a5b12d05e9828ff317853(const https://developer.android.com/reference/games/game-activity/struct/game-activity-pointer-axes#struct_game_activity_pointer_axes *pointerInfo)` | `float` Get the current X coordinate of the pointer. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga373c229898a568173b9ef3b323036761(const https://developer.android.com/reference/games/game-activity/struct/game-activity-pointer-axes#struct_game_activity_pointer_axes *pointerInfo)` | `float` Get the current Y coordinate of the pointer. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gad980053b71d9b316b868fe9d1f615d6b(https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity *activity)` | `void` Finish the given activity. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga5bd70f8f1cf5dd436f7bfdf9187280d6(const https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity *activity)` | `GameTextInput *` Get a pointer to the GameTextInput library instance. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga04cacc658d2a0420c9bbdb80ad3efcca(https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity *activity, GameTextInputGetStateCallback callback, void *context)` | `void` Get the last-received text entry state (see documentation of the GameTextInputState struct in the Game Text Input library reference). |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gae4ad602681d3c814211c61a6168d190a(https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity *activity, GameCommonInsetsType type, ARect *insets)` | `void` Get the current window insets of the particular component. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gaf7fceea34a9b8e7cd85210859f86ee32(https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity *activity, uint32_t flags)` | `void` Hide the IME while in the given activity. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga3dd8d1a75befe6f62bbf779e3ec95ed6(https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity *activity, int inputType, int actionId, int imeOptions)` | `void` Set options on how the IME behaves when it is requested for text input. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga28098031f5afaaa858bbbe86d543ea0d(https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity *activity, const GameTextInputState *state)` | `void` Set the text entry state (see documentation of the GameTextInputState struct in the Game Text Input library reference). |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gace95d6abebc1330b70c8ca408f6ba275(https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity *activity, uint32_t addFlags, uint32_t removeFlags)` | `void` Change the window flags of the given activity. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga4d43a31bcc6284a2698bfb349656af09(https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity *activity, uint32_t flags)` | `void` Show the IME while in the given activity. |

| ### Macros ||
|---|---|
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gae79cb4e649bc48d0b298229d276ba566 8` | The maximum number of pointers returned inside a motion event. |
| `https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ga60ac000e34de0fba28dc0637e85ed7fe 48` | The maximum number of axes supported in an Android MotionEvent. |

| ### Structs ||
|---|---|
| [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity) | This structure defines the native side of an android.app.GameActivity. |
| [GameActivityCallbacks](https://developer.android.com/reference/games/game-activity/struct/game-activity-callbacks) | These are the callbacks the framework makes into a native application. |
| [GameActivityKeyEvent](https://developer.android.com/reference/games/game-activity/struct/game-activity-key-event) | Describe a key event that happened on the [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity) SurfaceView. |
| [GameActivityMotionEvent](https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event) | Describe a motion event that happened on the [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity) SurfaceView. |
| [GameActivityPointerAxes](https://developer.android.com/reference/games/game-activity/struct/game-activity-pointer-axes) | Describe information about a pointer, found in a [GameActivityMotionEvent](https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event#struct_game_activity_motion_event). |

## Enumerations

### GameActivityHideSoftInputFlags

```text
 GameActivityHideSoftInputFlags
```
Flags for GameActivity_hideSoftInput; see the Java InputMethodManager API for documentation.

| Properties ||
|---|---|
| `GAMEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY` | The soft input window should only be hidden if it was not explicitly shown by the user. |
| `GAMEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS` | The soft input window should normally be hidden, unless it was originally shown with [GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1gga622c06202cfa7ee8b107cdbe1a4bad20a3b3f37b972ff58ceb83fedf1aebeb3be). |

### GameActivitySetWindowFlags

```text
 GameActivitySetWindowFlags
```
Flags for GameActivity_setWindowFlags, as per the Java API at android.view.WindowManager.LayoutParams.

| Properties ||
|---|---|
| `GAMEACTIVITY_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON` | As long as this window is visible to the user, allow the lock screen to activate while the screen is on. This can be used independently, or in combination with [GAMEACTIVITY_FLAG_KEEP_SCREEN_ON](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea1c9ed3c6d377c83f38634003addcf65f) and/or [GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eaf85357e08ab4c0f98432e866a9929325) |
| `GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM` | Invert the state of [GAMEACTIVITY_FLAG_NOT_FOCUSABLE](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea107475b076db2a03a4f39d0ff7d089b0) with respect to how this window interacts with the current method. That is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the window will behave as if it needs to interact with the input method and thus be placed behind/away from it; if [GAMEACTIVITY_FLAG_NOT_FOCUSABLE](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea107475b076db2a03a4f39d0ff7d089b0) is not set and this flag is set, then the window will behave as if it doesn't need to interact with the input method and can be placed to use more space and cover the input method. |
| `GAMEACTIVITY_FLAG_BLUR_BEHIND` | Blur everything behind this window. **[Deprecated.](https://developer.android.com/reference/games/game-activity/deprecated/deprecated)**Blurring is no longer supported. |
| `GAMEACTIVITY_FLAG_DIM_BEHIND` | Everything behind this window will be dimmed. |
| `GAMEACTIVITY_FLAG_DISMISS_KEYGUARD` | When set the window will cause the keyguard to be dismissed, only if it is not a secure lock keyguard. Because such a keyguard is not needed for security, it will never re-appear if the user navigates to another window (in contrast to [GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eaf85357e08ab4c0f98432e866a9929325), which will only temporarily hide both secure and non-secure keyguards but ensure they reappear when the user moves to another UI that doesn't hide them). If the keyguard is currently active and is secure (requires an unlock pattern) than the user will still need to confirm it before seeing this window, unless [GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eaf85357e08ab4c0f98432e866a9929325) has also been set. |
| `GAMEACTIVITY_FLAG_DITHER` | Turn on dithering when compositing this window to the screen. **[Deprecated.](https://developer.android.com/reference/games/game-activity/deprecated/deprecated)**This flag is no longer used. |
| `GAMEACTIVITY_FLAG_FORCE_NOT_FULLSCREEN` | Override [GAMEACTIVITY_FLAG_FULLSCREEN](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea588d2583d33666ba970ed63a50088324) and force the screen decorations (such as the status bar) to be shown. |
| `GAMEACTIVITY_FLAG_FULLSCREEN` | Hide all screen decorations (such as the status bar) while this window is displayed. This allows the window to use the entire display space for itself the status bar will be hidden when an app window with this flag set is on the top layer. A fullscreen window will ignore a value of [GAMEACTIVITY_SOFT_INPUT_ADJUST_RESIZE](https://developer.android.com/reference/games/game-activity//); the window will stay fullscreen and will not resize. |
| `GAMEACTIVITY_FLAG_IGNORE_CHEEK_PRESSES` | Intended for windows that will often be used when the user is holding the screen against their face, it will aggressively filter the event stream to prevent unintended presses in this situation that may not be desired for a particular window, when such an event stream is detected, the application will receive a [AMOTION_EVENT_ACTION_CANCEL](https://developer.android.com/reference/games/game-activity//) to indicate this so applications can handle this accordingly by taking no action on the event until the finger is released. |
| `GAMEACTIVITY_FLAG_KEEP_SCREEN_ON` | As long as this window is visible to the user, keep the device's screen turned on and bright. |
| `GAMEACTIVITY_FLAG_LAYOUT_INSET_DECOR` | A special option only for use in combination with [GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea147849279b726a081530b382dfc79076). When requesting layout in the screen your window may appear on top of or behind screen decorations such as the status bar. By also including this flag, the window manager will report the inset rectangle needed to ensure your content is not covered by screen decorations. |
| `GAMEACTIVITY_FLAG_LAYOUT_IN_SCREEN` | Place the window within the entire screen, ignoring decorations around the border (such as the status bar). The window must correctly position its contents to take the screen decoration into account. |
| `GAMEACTIVITY_FLAG_LAYOUT_NO_LIMITS` | Allows the window to extend outside of the screen. |
| `GAMEACTIVITY_FLAG_NOT_FOCUSABLE` | This window won't ever get key input focus, so the user can not send key or other button events to it. Those will instead go to whatever focusable window is behind it. This flag will also enable [GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea444dc3f1b07b2893729a0762a1b0a2c3) whether or not that is explicitly set. Setting this flag also implies that the window will not need to interact with a soft input method, so it will be Z-ordered and positioned independently of any active input method (typically this means it gets Z-ordered on top of the input method, so it can use the full screen for its content and cover the input method if needed. You can use [GAMEACTIVITY_FLAG_ALT_FOCUSABLE_IM](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7eaee40166acdb7d0117d6edd8a5133aafa) to modify this behavior. |
| `GAMEACTIVITY_FLAG_NOT_TOUCHABLE` | This window can never receive touch events. |
| `GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL` | Even when this window is focusable (its [GAMEACTIVITY_FLAG_NOT_FOCUSABLE](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea107475b076db2a03a4f39d0ff7d089b0) is not set), allow any pointer events outside of the window to be sent to the windows behind it. Otherwise it will consume all pointer events itself, regardless of whether they are inside of the window. |
| `GAMEACTIVITY_FLAG_SCALED` | A special mode where the layout parameters are used to perform scaling of the surface when it is composited to the screen. |
| `GAMEACTIVITY_FLAG_SECURE` | Treat the content of the window as secure, preventing it from appearing in screenshots or from being viewed on non-secure displays. |
| `GAMEACTIVITY_FLAG_SHOW_WALLPAPER` | Ask that the system wallpaper be shown behind your window. The window surface must be translucent to be able to actually see the wallpaper behind it; this flag just ensures that the wallpaper surface will be there if this window actually has translucent regions. |
| `GAMEACTIVITY_FLAG_SHOW_WHEN_LOCKED` | Special flag to let windows be shown when the screen is locked. This will let application windows take precedence over key guard or any other lock screens. Can be used with [GAMEACTIVITY_FLAG_KEEP_SCREEN_ON](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea1c9ed3c6d377c83f38634003addcf65f) to turn screen on and display windows directly before showing the key guard window. Can be used with [GAMEACTIVITY_FLAG_DISMISS_KEYGUARD](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea5de8c9533eb3822bf81ed0f6f14f62aa) to automatically fully dismisss non-secure keyguards. This flag only applies to the top-most full-screen window. |
| `GAMEACTIVITY_FLAG_TOUCHABLE_WHEN_WAKING` | When set, if the device is asleep when the touch screen is pressed, you will receive this first touch event. Usually the first touch event is consumed by the system since the user can not see what they are pressing on. **[Deprecated.](https://developer.android.com/reference/games/game-activity/deprecated/deprecated)**This flag has no effect. |
| `GAMEACTIVITY_FLAG_TURN_SCREEN_ON` | When set as a window is being added or made visible, once the window has been shown then the system will poke the power manager's user activity (as if the user had woken up the device) to turn the screen on. |
| `GAMEACTIVITY_FLAG_WATCH_OUTSIDE_TOUCH` | If you have set [GAMEACTIVITY_FLAG_NOT_TOUCH_MODAL](https://developer.android.com/reference/games/game-activity/group/game-activity#group___game_activity_1ggab2bf2fc256437ff71275ac1c8aa2cf7ea444dc3f1b07b2893729a0762a1b0a2c3), you can set this flag to receive a single special MotionEvent with the action [AMOTION_EVENT_ACTION_OUTSIDE](https://developer.android.com/reference/games/game-activity//) for touches that occur outside of your window. Note that you will not receive the full down/move/up gesture, only the location of the first down as an [AMOTION_EVENT_ACTION_OUTSIDE](https://developer.android.com/reference/games/game-activity//). |

### GameActivityShowSoftInputFlags

```text
 GameActivityShowSoftInputFlags
```
Flags for GameActivity_showSoftInput; see the Java InputMethodManager API for documentation.

| Properties ||
|---|---|
| `GAMEACTIVITY_SHOW_SOFT_INPUT_FORCED` | The user has forced the input method open (such as by long-pressing menu) so it should not be closed until they explicitly do so. |
| `GAMEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT` | Implicit request to show the input window, not as the result of a direct request by the user. |

## Typedefs

### GameActivity

```text
struct GameActivity GameActivity
```
This structure defines the native side of an android.app.GameActivity.

It is created by the framework, and handed to the application's native code as it is being launched.

### GameActivityCallbacks

```text
struct GameActivityCallbacks GameActivityCallbacks
```
These are the callbacks the framework makes into a native application.

All of these callbacks happen on the main thread of the application. By default, all callbacks are NULL; set to a pointer to your own function to have it called.

### GameActivityKeyEvent

```text
struct GameActivityKeyEvent GameActivityKeyEvent
```
Describe a key event that happened on the [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity) SurfaceView.

This is 1:1 mapping to the information contained in a Java `KeyEvent` (see <https://developer.android.com/reference/android/view/KeyEvent>).

### GameActivityMotionEvent

```text
struct GameActivityMotionEvent GameActivityMotionEvent
```
Describe a motion event that happened on the [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity) SurfaceView.

This is 1:1 mapping to the information contained in a Java `MotionEvent` (see <https://developer.android.com/reference/android/view/MotionEvent>).

### GameActivityPointerAxes

```text
struct GameActivityPointerAxes GameActivityPointerAxes
```
Describe information about a pointer, found in a [GameActivityMotionEvent](https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event#struct_game_activity_motion_event).

You can read values directly from this structure, or use helper functions (`GameActivityPointerAxes_getX`, `GameActivityPointerAxes_getY` and `GameActivityPointerAxes_getAxisValue`).

The X axis and Y axis are enabled by default but any other axis that you want to read **must** be enabled first, using `GameActivityPointerAxes_enableAxis`.


**See also:**
[GameActivityMotionEvent](https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event#struct_game_activity_motion_event)

### GameActivity_createFunc

```scdoc
void GameActivity_createFunc(GameActivity *activity, void *savedState, size_t savedStateSize)
```
This is the function that must be in the native code to instantiate the application's native activity.

It is called with the activity instance (see above); if the code is being instantiated from a previously saved instance, the savedState will be non-NULL and point to the saved data. You must make any copy of this data you need it will be released after you return from this function.

### SaveInstanceStateRecallback

```gdscript
void(* SaveInstanceStateRecallback)(const char *bytes, int len, void *context)
```
A function the user should call from their callback with the data, its length and the library- supplied context.

## Variables

### GameActivity_onCreate

```scdoc
GameActivity_createFunc GameActivity_onCreate
```
The name of the function that NativeInstance looks for when launching its native code.

This is the default function that is used, you can specify "android.app.func_name" string meta-data in your manifest to use a different function.

## Functions

### GameActivityKeyEvent_fromJava

```scdoc
void GameActivityKeyEvent_fromJava(
  JNIEnv *env,
  jobject motionEvent,
  GameActivityKeyEvent *out_event
)
```
Convert a Java `KeyEvent` to a `https://developer.android.com/reference/games/game-activity/struct/game-activity-key-event#struct_game_activity_key_event`.

This is done automatically by the [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity): see `onKeyUp` and `onKeyDown` to set a callback to consume the received events. This function can be used if you re-implement events handling in your own activity. Ownership of out_event is maintained by the caller.

### GameActivityMotionEvent_fromJava

```scdoc
void GameActivityMotionEvent_fromJava(
  JNIEnv *env,
  jobject motionEvent,
  GameActivityMotionEvent *out_event
)
```
Convert a Java `MotionEvent` to a `https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event#struct_game_activity_motion_event`.

This is done automatically by the [GameActivity](https://developer.android.com/reference/games/game-activity/struct/game-activity#struct_game_activity): see `onTouchEvent` to set a callback to consume the received events. This function can be used if you re-implement events handling in your own activity. Ownership of out_event is maintained by the caller.

### GameActivityPointerAxes_disableAxis

```scdoc
void GameActivityPointerAxes_disableAxis(
  int32_t axis
)
```
Disable the specified axis.

Its value won't be reported in the [GameActivityPointerAxes](https://developer.android.com/reference/games/game-activity/struct/game-activity-pointer-axes#struct_game_activity_pointer_axes) structures stored in a motion event anymore.

Apart from X and Y, any axis that you want to read **must** be enabled first, using `GameActivityPointerAxes_enableAxis`.

If the axis index is out of range, nothing is done.

### GameActivityPointerAxes_enableAxis

```scdoc
void GameActivityPointerAxes_enableAxis(
  int32_t axis
)
```
Enable the specified axis, so that its value is reported in the [GameActivityPointerAxes](https://developer.android.com/reference/games/game-activity/struct/game-activity-pointer-axes#struct_game_activity_pointer_axes) structures stored in a motion event.

You must enable any axis that you want to read, apart from `AMOTION_EVENT_AXIS_X` and `AMOTION_EVENT_AXIS_Y` that are enabled by default.

If the axis index is out of range, nothing is done.

### GameActivityPointerAxes_getAxisValue

```scdoc
float GameActivityPointerAxes_getAxisValue(
  GameActivityPointerAxes *pointerInfo,
  int32_t axis
)
```
Get the value of the requested axis.

Apart from X and Y, any axis that you want to read **must** be enabled first, using `GameActivityPointerAxes_enableAxis`.

Find the valid enums for the axis (`AMOTION_EVENT_AXIS_X`, `AMOTION_EVENT_AXIS_Y`, `AMOTION_EVENT_AXIS_PRESSURE`...) in <https://developer.android.com/ndk/reference/group/input>.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `pointerInfo` | The structure containing information about the pointer, obtained from [GameActivityMotionEvent](https://developer.android.com/reference/games/game-activity/struct/game-activity-motion-event#struct_game_activity_motion_event). | | `axis` | The axis to get the value from | |
| **Returns** | The value of the axis, or 0 if the axis is invalid or was not enabled. |

### GameActivityPointerAxes_getX

```gdscript
float GameActivityPointerAxes_getX(
  const GameActivityPointerAxes *pointerInfo
)
```
Get the current X coordinate of the pointer.

### GameActivityPointerAxes_getY

```gdscript
float GameActivityPointerAxes_getY(
  const GameActivityPointerAxes *pointerInfo
)
```
Get the current Y coordinate of the pointer.

### GameActivity_finish

```scdoc
void GameActivity_finish(
  GameActivity *activity
)
```
Finish the given activity.

Its finish() method will be called, causing it to be stopped and destroyed. Note that this method can be called from *any* thread; it will send a message to the main thread of the process where the Java finish call will take place.

### GameActivity_getTextInput

```gdscript
GameTextInput * GameActivity_getTextInput(
  const GameActivity *activity
)
```
Get a pointer to the GameTextInput library instance.

### GameActivity_getTextInputState

```scdoc
void GameActivity_getTextInputState(
  GameActivity *activity,
  GameTextInputGetStateCallback callback,
  void *context
)
```
Get the last-received text entry state (see documentation of the GameTextInputState struct in the Game Text Input library reference).

### GameActivity_getWindowInsets

```carbon
void GameActivity_getWindowInsets(
  GameActivity *activity,
  GameCommonInsetsType type,
  ARect *insets
)
```
Get the current window insets of the particular component.

See <https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type> for more details. You can use these insets to influence what you show on the screen.

### GameActivity_hideSoftInput

```scdoc
void GameActivity_hideSoftInput(
  GameActivity *activity,
  uint32_t flags
)
```
Hide the IME while in the given activity.

Calls InputMethodManager.hideSoftInput() for the given activity. Note that this method can be called from *any* thread; it will send a message to the main thread of the process where the Java finish call will take place.

### GameActivity_setImeEditorInfo

```scdoc
void GameActivity_setImeEditorInfo(
  GameActivity *activity,
  int inputType,
  int actionId,
  int imeOptions
)
```
Set options on how the IME behaves when it is requested for text input.

See <https://developer.android.com/reference/android/view/inputmethod/EditorInfo> for the meaning of inputType, actionId and imeOptions.

Note that this function will attach the current thread to the JVM if it is not already attached, so the caller must detach the thread from the JVM before the thread is destroyed using DetachCurrentThread.

### GameActivity_setTextInputState

```gdscript
void GameActivity_setTextInputState(
  GameActivity *activity,
  const GameTextInputState *state
)
```
Set the text entry state (see documentation of the GameTextInputState struct in the Game Text Input library reference).

Ownership of the state is maintained by the caller.

### GameActivity_setWindowFlags

```scdoc
void GameActivity_setWindowFlags(
  GameActivity *activity,
  uint32_t addFlags,
  uint32_t removeFlags
)
```
Change the window flags of the given activity.

Calls getWindow().setFlags() of the given activity. Note that some flags must be set before the window decoration is created, see <https://developer.android.com/reference/android/view/Window#setFlags(int,%20int)>. Note also that this method can be called from *any* thread; it will send a message to the main thread of the process where the Java finish call will take place.

### GameActivity_showSoftInput

```scdoc
void GameActivity_showSoftInput(
  GameActivity *activity,
  uint32_t flags
)
```
Show the IME while in the given activity.

Calls InputMethodManager.showSoftInput() for the given activity. Note that this method can be called from *any* thread; it will send a message to the main thread of the process where the Java call will take place.

## Macros

### GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT

```scdoc
 GAMEACTIVITY_MAX_NUM_POINTERS_IN_MOTION_EVENT 8
```
The maximum number of pointers returned inside a motion event.

### GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT

```scdoc
 GAME_ACTIVITY_POINTER_INFO_AXIS_COUNT 48
```
The maximum number of axes supported in an Android MotionEvent.

See <https://developer.android.com/ndk/reference/group/input>.