Skip to main content

Go Home

The Go Home action simulates pressing the Android Home button. It exits the current application and returns the device to the Home screen.

When to Use

Use this action when you want to:

  • End an automation workflow.
  • Exit the current application.
  • Return the device to a known state before starting another task.

Syntax

var task = suremdmjs.automate().goHome();

suremdmjs.automate().performAction(
task,
"onSuccess",
"onFailure"
);

Parameters

This action does not require any parameters.

Example

!#suremdmjs
returnHome();

function returnHome() {
var task = suremdmjs.automate().goHome();

suremdmjs.automate().performAction(
task,
"homeDisplayed",
"homeFailed"
);
}

function homeDisplayed() {
suremdmjs.log("Home screen displayed.");
}

function homeFailed() {
suremdmjs.log("Unable to return to the Home screen.");
}

Expected Result

The device exits the current application and displays the Home screen.

💬 Help us improve this documentation

Was this information useful?

Your feedback helps us keep our documentation accurate, up to date, and useful.