Skip to main content
Version: 7.5.5

Device actions

launchApp

Method allowing to launch an application.

ParameterTypeDescription
{ id, path, type?, args? }string , string , string , any[]Application id, Application path, Application type, extra arguments.

Basic Usage

await I.launchApp(
{id: "appId",
path: "./../path-to-the-app",
type: "appType"}); // optional

closeApp

Method allowing to close a specific application.

ParameterTypeDescription
idstringApplication id.

Basic Usage

await I.closeApp("appId");

switchToApp

Method allowing to switch to a specific application.

ParameterTypeDescription
idstringApplication id.

Basic Usage

await I.switchToApp("appId");

switchContext

Method allowing to switch between contexts.

ParameterTypeDescription
idstringContext id.

Basic Usage

const newContext = await I.switchContext("contextId");

getContext

Method allowing to get the current context.

Return Value

context: string

Returns the current context as a string.

Example

const currentContext = await I.getContext();
console.log(currentContext);

This example retrieves the current context using the getContext method. The currentContext variable will contain the current context as a string.

getContexts

Method allowing to get the existing contexts.

Return Value

contexts: string[]

Returns an array of the available contexts as an array of strings.

Example

const availableContexts = await I.getContexts();
console.log(availableContexts);

This example retrieves the available contexts using the getContexts method. The availableContexts variable will contain an array of strings representing the available contexts.

getOrientation

Method allowing to get the orientation of the device.

Return Value

orientation: 'LANDSCAPE' | 'PORTRAIT'

Returns the current orientation of the device, which can be either 'LANDSCAPE' or 'PORTRAIT'.

Example

const deviceOrientation = await I.getOrientation();
console.log(deviceOrientation);

This example retrieves the current device orientation using the getOrientation method. The deviceOrientation variable will contain either 'LANDSCAPE' or 'PORTRAIT' based on the device's orientation.

setOrientation

Method allowing to set the orientation of the device.

ParameterTypeDescription
orientationLANDSCAPE / PORTRAITDevice orientation.

Basic Usage

await I.setOrientation("LANDSCAPE"); // or "PORTRAIT"

getGeoLocation

Method allowing to get the geographical location.

Return Value

location: { latitude: number; longitude: number; altitude: number; }

Returns the latitude, longitude, and altitude values of the received location.

Example

const currentLocation = await I.getGeoLocation();
console.log(currentLocation);

This example retrieves the current geographical location using the getGeoLocation method. The currentLocation object will contain latitude, longitude, and altitude values.

setGeoLocation

Method allowing to set a specific geographical location.

ParameterTypeDescription
location{latitude: number; longitude: number; altitude: number;}Define a location.

Example

const newLocation = {
latitude: 37.7749,
longitude: -122.4194,
altitude: 0,
};

await I.setGeoLocation(newLocation);