Search code examples
androidautomationappiumappium-android

How to switch from one native to another native app using Appium?


I have to switch to another native application from runtime native application. Tried with below the mentioned startActivty() methods:

driver.startActivity(settingsAppPackageName, settingsAppActivityName); 

&

driver.startActivity(new Activity("package.activityname"));

Using appium desktop with v1.4.1 any solution from automation geeks would be appreciated.


Solution

  • Finally, found a solution for it.

    static void launchSecurityXxxApp(AppiumDriver<AndroidElement> driver) throws MalformedURLException {
    
        String appPackage="com.xxx.xxxx";
        String appActivity="com.xxx.xxxx.Launchable";
        Activity activity = new Activity(appPackage, appActivity);
        activity.setStopApp(false);
        ((AndroidDriver<AndroidElement>) driver).startActivity(activity);
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    }