# Titanium.Gesture

> The Gesture module is responsible for high-level device gestures such as orientation changes and shake gestures.

- Source: https://titaniumsdk.com/docs/sdk/12.5.1/Titanium.Gesture
- Titanium SDK version: 12.5.1
- Kind: module
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 0.8
- Extends: Titanium.Module
- Inheritance: Titanium.Module > Titanium.Proxy

## Properties

### landscape

- Type: Boolean
- Platforms: Android, iPhone, iPad, macOS
- Permission: read-only

Indicates if the device is currently held in landscape form.

Value is `true` if in landscape, and `false` otherwise.

### orientation

- Type: Number
- Platforms: Android, iPhone, iPad, macOS
- Permission: read-only

Orientation of the device.

Value may be one of the group of [Titanium.UI](https://titaniumsdk.com/docs/sdk/Titanium.UI.md) orientation constants,
[Titanium.UI.PORTRAIT](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PORTRAIT),
[Titanium.UI.UPSIDE_PORTRAIT](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#UPSIDE_PORTRAIT),
[Titanium.UI.LANDSCAPE_LEFT](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#LANDSCAPE_LEFT),
[Titanium.UI.LANDSCAPE_RIGHT](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#LANDSCAPE_RIGHT),
[Titanium.UI.FACE_UP](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#FACE_UP),
[Titanium.UI.FACE_DOWN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#FACE_DOWN),
or [Titanium.UI.UNKNOWN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#UNKNOWN).

On iOS and Windows, returns the current orientation of the *device*,
regardless of the window orientation. To determine the current window orientation,
use [Window.orientation](https://titaniumsdk.com/docs/sdk/Titanium.UI.Window.md#orientation).

To set the *allowable* orientations for a window, see [Titanium.UI.Window.orientationModes](https://titaniumsdk.com/docs/sdk/Titanium.UI.Window.md#orientationModes).

### portrait

- Type: Boolean
- Platforms: Android, iPhone, iPad, macOS
- Permission: read-only

Indicates if the device is currently held in portrait form.

Value is `true` if in portrait, and `false` otherwise.

## Methods

### stopListener

- Platforms: Android
- Since: Titanium SDK 12.1.0

Stops the gesture listener.

In case you use `Titanium.Gesture.landscape` or `Titanium.Gesture.portrait` it will attach the orientation
listener automatically. If you just use it once you can use this method to stop the listener.

## Events

### orientationchange

- Platforms: Android, iPhone, iPad, macOS

Fired when the device orientation changes.

On Android, note that the application must have a heavyweight window or tab group open
in order to receive the `orientationchange` event. It is not necessary for the  heavyweight
window to be the topmost window.

Almost all real-world applications will have a heavyweight window or a tab group. This is
only likely to be an issue if you create a test case or test application that adds an
orientation change listener from `app.js` without opening a heavyweight window.

Event properties:

- `orientation` (Number): Orientation of the device.

### shake

- Platforms: Android, iPhone, iPad, macOS

Fired when the device is shaken.

A shake gesture consists of a series of quick accelerations, and is represented by a series
of shake events.

The `timestamp` property represents the interval between shake events. It is measured in
milliseconds on Android, and in seconds on iOS.

Event properties:

- `timestamp` (Number): Time interval since previous shake event. On iOS, this value is 0 for the first shake event in a series.
- `x` (Number): Acceleration along the X axis, in Gs.
- `y` (Number): Acceleration along the Y axis, in Gs.
- `z` (Number): Acceleration along the Z axis, in Gs.

## Inherited members

7 members are inherited. Each is documented on the type that declares it.

- [Titanium.Proxy](https://titaniumsdk.com/docs/sdk/12.5.1/Titanium.Proxy.md): `addEventListener`, `apiName`, `applyProperties`, `bubbleParent`, `fireEvent`, `lifecycleContainer`, `removeEventListener`

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

