Duration of "background_app" API


I’m trying to use the Appium API “background_app(seconds)”
and if I’m using it for a short duration (less then two minutes ) it’s working,
but when I use it for 20 minutes it’s not working correctly and can’t return to the app after moving to the background.

seld.driver.background_app(90) --Works
seld.driver.background_app(1200) – Fails

Can someone help me with it or validate he also encountered this problem


We do “background_app(-1)”, which means ‘forever’. Then when we need to reopen the app we navigate to it and open it back up. You don’t specify the device os, but we are on iOS using Ruby. Unless your test is very dependent on the time you are using to background this should be a good solution. Here is a link for doing this in various languages. Note that although the comment says, ‘# deactivate app’, our experience is that it keeps running in the background and can be brought up and interacted with no problems:


Thanks @wreed ,

we are using APPIUM Desktop 1.15.0 on iOS with Python 3.7
after I preformed the “background_app(-1)” the app went to the background.
and for reopening it I tried to use: drive.start_activity() API, but its return an exception: " Method has not yet been implemented"

this API works on Android!
so you can explain to me how you reopen the application with the navigation?

We navigate the Springboard to the app and click it. Then we continue interaction.