Switching between apps without relauncing

I an trying to switch between the chrome browser and a hybrid app .Is there is any way to switch between the apps without relaunching it. I have gone through some blogs and support pages but saw that the apps will be relaunched when calling driver.startActivity().So i need some workaround where the apps will bot get relaunched. Please let me know if there is any other method that can be used.

do you ask for android or iOS ?

If it’s for Android try using adb commands:

Call this method twice and you will be able to switch between apps
public static void switchApp(){
runCommand(“adb shell input keyevent KEYCODE_APP_SWITCH”);
}

here is the runCommand:
public static String runCommand(String command){
String output = null;
try{
Scanner scanner = new Scanner(Runtime.getRuntime().exec(command).getInputStream()).useDelimiter("\A");
if(scanner.hasNext()) output = scanner.next();
}catch (IOException e){
throw new RuntimeException(e.getMessage());
}
return output;
}

you can use activateApp API

I am asking for both android and iOS @Bilal_Jarwan

okay thank you @chouaib_saadi will try this

okay @mykola-mokhnach Will try this aswell

this article for iOS.

@chouaib_saadi i try ur solution but that reopen current app
i want to switch to another app without relaunching
ur solution dont work in android 6 i need a solution for all version of android