Foreground application


I don’t know if this is a bug or a designed behaviour but I have a problem with returning a backgrounded app to foreground.

I have an application that has a way to redirect people to the store in order to download other applications. That action is bound to a button and opens the device marketplace. I also have coded the automation of those tasks, getting the user to the store and having the main application backgrounded, but I am unable to return to the application on iOS platform.

I use runAppInBackground method to return the application from background (in fact it sends it to background and recovers it) but that method only works properly on Android (1.3.7). When doing the same on iOS the application that is backgrounded is the AppStore (current foreground application) (1.4.8).

My first question is: Can I get my application back? How?
Then the other question arises: Why is Android returning the launched application to foreground and iOS is working on the foreground app to background and return? Is that intended?


Note: I can not use 1.3.7 on iOS since iOS 8.x broke support on runAppInBackground, nor can I use 1.4.8 on Android because 1.4.x version has a bug that restarts the application.

We use appium_driver.start_activity (Ruby) to return our application to the foreground on Android. I would hope the same would work on iOS

startActivity method is only available for Android :frowning:

Actually we can raise a bug at appium end saying senkeyevent keycodes and startActivity methods should be implemented in IOSDriver also…

Keycodes are unique to android/adb.

before that, is there any check like we can find out that the app is in the background so that i will launch ?

You can check the current activity using appium methods, and if it matches, then you should be good to go. If you have reason to interact with lock screen, or the notification screen, Appium’s methods are not reliable.