How to launch a activity directly


In my application, when i launch the application(starts with SplashActivity), and if the user is not signed in, it will take to login page, once logged in takes to home page(HomePageActivity).

For this what i am doing is, i am manually logging into the application, and in script i am trying to start HomePageActivity like
driver.startActivity(“my app pkg name”,“HomePageActivity”).

When i run my script the application starting from scratch(starting from login) it always taking to “SplashActivity”.

Following is the code:

    AndroidDriver driver;
    String strPackageName="pkg name"; 
    String strActivityName=".Activityname";
    String strApkFilePath="app path";
    public void launch360App()
        File objFile=new File(strApkFilePath);
        DesiredCapabilities capabilities=new DesiredCapabilities();
        capabilities.setCapability("deviceName", "Testing");
        capabilities.setCapability("app", objFile.getAbsolutePath());
            AndroidDriver driver=new AndroidDriver(new URL(""),capabilities);
        catch(Exception e)
    public void startActivity(String strActivityName)
        driver.startActivity(strPackageName, strActivityName);

Where i am doing wrong? How to overcome it?

Thanks in advance,

Hi @UD,

Could you check what settings you have provided in Appium-> Android Settings for app, if it is Full Reset or No Reset selected?

And could you also mention how you are launching Appium?


Hi Sujatha,

The issue is resolved when i specify the full activity name like “pkgname.ActivityName” whereas i see problem when i specify “.ActivityName”


Great :slight_smile: It worked for you.


I was wondering, when we get the currentActivity name by driver.currentActivity, it just displays “.ActivityName” but when we to set the activity, when should we append package name before Activity name, i dont know.

Appium should have allowed if we just specify “.ActivityName” while setting the activity name.

By mentioning the activity in the capabilities. Ex:-

   capabilities.SetCapability("appPackage", ""); 
   capabilities.SetCapability("appActivity", "freesat.droid.SplashActivity");


If you specifying in capabilities means it becomes static, in the sense that the user may want to jump to any activity then which may not be useful.

So the reason we have driver.StartActivity method.