Showing posts with label MainActivity. Show all posts
Showing posts with label MainActivity. Show all posts

Sunday, July 30, 2023

How to identify the main actvity from the AndroidManifest.xml

 When you setup applium capacbilities giving the app package and app activity, you have to give the main activity as the app activity.

Here is how you identify the main activity from AndroidManifest.xml when it has multiple activities.

  • Locate the AndroidManifest.xml:

The AndroidManifest.xml file is located in the app folder of your Android project. The typical path is app/src/main/AndroidManifest.xml.

  • Open the AndroidManifest.xml:

Use a text editor or an XML editor to open the AndroidManifest.xml file.

  • Search for <activity> tags:

Inside the AndroidManifest.xml, look for <activity> tags. Each <activity> tag represents an activity (screen) of the Android application.

  • Find the Main Activity:

The AppActivity is usually the main activity of the app. It is the entry point of the application, and its intent filter is often set to respond to the android.intent.action.MAIN and android.intent.category.LAUNCHER actions.

  • Look for Intent Filters:

Inside the <activity> tags, check for <intent-filter> tags. The AppActivity should have an <intent-filter> that includes the android.intent.action.MAIN and android.intent.category.LAUNCHER actions.

  • Extract the AppActivity Name:

Extract the value of the android:name attribute from the <activity> tag that has the <intent-filter> with the android.intent.action.MAIN and android.intent.category.LAUNCHER actions. The value of android:name attribute will be the AppActivity.

<activity

    android:name=".ui.MainActivity"  <!-- This is the AppActivity -->

    android:label="@string/app_name">

    <intent-filter>

        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />

    </intent-filter>

</activity>


In this example, the AppActivity is .ui.MainActivity.


Featured

Selenium - Page Object Model and Action Methods

  How we change this code to PageObjectModel and action classes. 1 2 3 driver . findElement ( By . id ( "userEmail" )). sendKeys (...

Popular Posts