Device Shake (FR)

Perfecto Command

perfecto:handset:shake

Purpose

On iOS: Triggers a virtual shake gesture on the device to activate features or modes that rely on physical shaking, such as entering development or test mode. You can also use it to trigger the React Native development menu in debuggable apps.

On Android: Only triggers the React Native development menu in debuggable apps. This feature requires enablement. To request this feature for your cloud, contact Perfecto Support.

Parameters

None

Return Value

OK

Exceptions

The following exceptions may occur when working with Android devices.

Exception

Code Description

GESTURE_SHAKE_NOT_SUPPORTED

554

Thrown if the shakeSupportedAndroid flag is not enabled in the cloud

CANNOT_GET_TOP_ACTIVITY

1206

Thrown if no foreground application is detected

APPLICATION_ON_TOP_NOT_SUPPORTED

403

Thrown if the application currently in the foreground does not support this operation (if it is not a React Native debuggable app)

Example

Copy

Java sample

Map<String, String> params = new HashMap<>();
getDriver().executeScript(“perfecto:handset:shake”, params);