Inject motion (FR)

Perfecto Command

mobile:motion:inject

Supported OS: Android

Purpose

Injects a DetectedActivity object that identifies an activity of the device that has been detected with a "level of confidence" that the user is performing this activity. The command should be activated by the automation script periodically to simulate activity by the user.

The application must have been sensor instrumented at time of installation on the device.

One of the two application identifiers (name or identifier) is required.

Important:

This command is supported for Early Access customers. Contact Perfecto Support if you wish to join the Early Access progam.

Parameters

Name Values Default Description
deviceId*

The device for this command.
name

The application name as it is displayed on the device screen.
identifier

The identifier of the application.
vehicle

Indicates the likelyhood that device is currently in a moving vehicle.
Value is in range [0,100]
bicycle

Indicates the likelyhood that device is currently moving on a bicycle.
Value is in range [0,100]
foot

Indicates the likelihood that device is currently moving in possession of person who is running or walking.
Value is in range [0,100]
walking

Indicates the likelihood that device is currently in possession of person who is walking.
Value is in range [0,100]
running

Indicates the likelihood that device is currently in possession of person who is running.
Value is in range [0,100]
still

Indicates the likelihood that device is currently standing in current position.
Value is in range [0,100]
tilting

Indicates the likelihood that device's angle relative to its center of gravity has changed. Usually indicates that the device is picked up from a desk or a user who is sitting stands up.
Value is in range [0,100]
unknown

Indicates the likelihood that device is moving due to an unidentified activity. Value is in range [0,100]

* Mandatory parameter

Return Value

None

Exceptions

None

Examples

Copy

Java sample

//Bicycle set to 84% probability
        Map<String, Object> params = new HashMap<String, Object>();
        params = new HashMap<>();
        params.put("identifier", appPackage);
        params.put("name","MotionDetector");
        params.put("bicycle","84");
        params.put("vehicle","9");
        params.put("foot","1");
        params.put("walking","1");
        params.put("running","2");
        params.put("still","1");
        params.put("tilting","1");
        params.put("unknown","1");
        driver.executeScript("mobile:motion:inject", params);
Java sample
//Bicycle set to 84% probability
        Map<String, Object> params = new HashMap<String, Object>();
        params = new HashMap<>();
        params.put("identifier", appPackage);
        params.put("name","MotionDetector");
        params.put("bicycle","84");
        params.put("vehicle","9");
        params.put("foot","1");
        params.put("walking","1");
        params.put("running","2");
        params.put("still","1");
        params.put("tilting","1");
        params.put("unknown","1");
        driver.executeScript("mobile:motion:inject", params);