How to close the android application from background using appium?

Could you please let me know to close the android app from the background .It should not be visible when we click on device home button.
2. How to open the app again with the previous state.

Please provide me the hint,how can we achieve this.

Shiva Oleti

1 Like

To minimise the application or to take application to background:

  1. User driver.close();

  2. If you are in the first page of the application, You also can user driver.navigate().back()

To launch the application with the previous state:

  1. Use: driver.launchApp();

Before doing this:

  1. If you have a code written for β€œ@after” method Comment that code.

// Comment this part of code.
/* @After
public void tearDown() {
} */

This will close the session and will create a new session

  1. Also in your Appium GUI , Uncheck the Full Reset checkbox. This will reset the data upon launching the application.

Hi,Thank you for your reply.
I don’t want the application to be in background. My requirement is to exit the app from back ground and start it again.( In which state i have exited)

Is there any method to handle such requirement?

For example:
If i logged into facebook,i exit the app and opened again. I should able to open the app in which state i had closed.

Shiva Oleti