Close application (FR)

Perfecto Command

mobile:application:close

Purpose

Closes an application on the device. The application process is killed, not minimized. If you reopen the application, the application will launch from the start page. (If you minimize the application, for example by using the Home button, the application will launch from the last page previously open.)

To use this command, the application identifier is required. For information on retrieving the application identifier, see Application identifier.

This command does not clear the cache. Service applications that live forever in the background may be auto-relaunched.

Parameters

Name Type Possible Values Description
name String The application name as it is displayed on the device screen.
identifier String The identifier of the application.

Return Value

String - "OK" or "Failed"

Exceptions

None

Examples

Copy

Java sample

 //declare the Map for script parameters
Map<String, Object> params = new HashMap<>();
  
params.put("identifier", "com.google.android.apps.maps");
driver.executeScript("mobile:application:close", params);
Copy

C# sample

 //declare the Map for script parameters
Dictionary<String, Object> pars = new Dictionary<String, Object>();
  
pars.Add("identifier", "com.google.android.apps.maps");
driver.ExecuteScript("mobile:application:close", pars);