I can't get Driver.start_activity to work on the Python

I tried this:

intent = { ‘intent’: ‘android.intent.action.MAIN’, ‘flags’: ‘0x10200000’, ‘targetPackage’: “com.google.android.apps.messaging”, ‘targetActivity’: “com.google.android.apps.messaging.ui.ConversationListActivity” } driver.execute_script(‘mobile:startActivity’, intent)

But the app is not opened

Appium server error:

[AndroidUiautomator2Driver@1a03 (f0787133)] Calling AppiumDriver.execute() with args: [“mobile:startActivity”,[{“intent”:“android.intent.action.MAIN”,“flags”:“0x10200000”,“targetPackage”:“com.google.android.apps.messaging”,“targetActivity”:“com.google.android.apps.messaging.ui.ConversationListActivity”}],“f0787133-0f00-4616-9ff8-81656c10a7b2”]

[AndroidUiautomator2Driver@1a03 (f0787133)] Executing method ‘mobile: startActivity’

[ADB] Running ‘C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s LMF100EMW618825c3 shell am start-activity android.intent.action.MAIN -f 0x10200000’

[AndroidUiautomator2Driver@1a03 (f0787133)] Responding to client with driver.execute() result: “Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] pkg=android.intent.action.MAIN }, type: 0, mode: 0, bounds: null”

[HTTP] ← POST /session/f0787133-0f00-4616-9ff8-81656c10a7b2/execute/sync 200 214 ms - 165

[HTTP]

[HTTP] → DELETE /session/f0787133-0f00-4616-9ff8-81656c10a7b2

[HTTP] {}

[AndroidUiautomator2Driver@1a03 (f0787133)] Calling AppiumDriver.deleteSession() with args: [“f0787133-0f00-4616-9ff8-81656c10a7b2”]

[AppiumDriver@f680] Event ‘quitSessionRequested’ logged at 1712075927430 (22:08:47 GMT+0530 (India Standard Time))

[AppiumDriver@f680] Removing session f0787133-0f00-4616-9ff8-81656c10a7b2 from our master session list

[AndroidUiautomator2Driver@1a03 (f0787133)] Deleting UiAutomator2 session

[AndroidUiautomator2Driver@1a03 (f0787133)] Deleting UiAutomator2 server session

[AndroidUiautomator2Driver@1a03 (f0787133)] Matched ‘/’ to command name ‘deleteSession’

[AndroidUiautomator2Driver@1a03 (f0787133)] Proxying [DELETE /] to [DELETE http://127.0.0.1:8204/session/88ca9937-fe3e-47ed-829b-70fdc90d1965] with no body

[AndroidUiautomator2Driver@1a03 (f0787133)] Got response with status 200: {“sessionId”:“88ca9937-fe3e-47ed-829b-70fdc90d1965”,“value”:null}

[ADB] Running ‘C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s LMF100EMW618825c3 shell dumpsys activity services io.appium.settings/.recorder.RecorderService’

[ADB] Running ‘C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s LMF100EMW618825c3 shell am force-stop com.instockconsumerapp’

[Logcat] Stopping logcat capture

[ADB] Removing forwarded port socket connection: 8204

[ADB] Running ‘C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s LMF100EMW618825c3 forward --remove tcp:8204’

[AndroidUiautomator2Driver@1a03 (f0787133)] Restoring hidden api policy to the device default configuration

[ADB] Running ‘C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s LMF100EMW618825c3 shell ‘settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy’’

[AppiumDriver@f680] Event ‘quitSessionFinished’ logged at 1712075928097 (22:08:48 GMT+0530 (India Standard Time))

[AppiumDriver@f680] Received response: null

[AppiumDriver@f680] But deleting session, so not returning

[AppiumDriver@f680] Responding to client with driver.deleteSession() result: null

[HTTP] ← DELETE /session/f0787133-0f00-4616-9ff8-81656c10a7b2 200 698 ms - 14

Are you sure correct argument names are used to invoke this API?

Yes, this is the code i used before: intent = { ‘intent’: ‘android.intent.action.MAIN’, ‘flags’: ‘0x10200000’, ‘targetPackage’: “com.google.android.apps.messaging”, ‘targetActivity’: “com.google.android.apps.messaging.ui.ConversationListActivity” } driver.execute_script(‘mobile:startActivity’, intent)

Now this command its working for me: driver.activate_app(‘com.google.android.apps.messaging’) its working