[Mobile] Execute Mobile Command
Description​
Execute a native mobile command.
Keyword name: Mobile.executeMobileCommand
Parameters​
| Parameter | Parameter Type | Required | Description | 
|---|---|---|---|
| command | String | Yes | Mobile command name | 
| args | Map | Yes | The provided arguments for which the command is required | 
| flowControl | FailureHandling | Optional | Specify failure handling schema to determine whether the execution should be allowed to continue or stop. | 
Returns​
The command's result with the Object type.
If Katalon Studio could not find the specified element, throws StepFailedException.
Example​
You want to use a custom Appium command to grant a specific permission (in this case, READ_CONTACTS) to a mobile app programmatically, without prompting the user:
import com.google.common.collect.ImmutableMap as ImmutableMap;
Mobile.startApplication('C:\Users\katalon\Sample Apps\APIDemos.apk', 
true)
String command = "mobile:changePermissions"
Map args = ImmutableMap.of(
  "action", "grant",
  "appPackage","com.hmh.api",
  "permissions", "android.permission.READ_CONTACTS")
Object result = Mobile.executeMobileCommand(command, args)
print result
Mobile.closeApplication()