Thursday, October 04, 2012

How to Launch an activity/application  in android from commandline:
=============================================

commands to launch an application in android:

adb shell am start -a android.intent.action.MAIN -n packageName/.mainActivityName

If I want to launch one application from commandline, what things I need to do:

1)From APK's AndroidManifest.xml,we can identify the main activity.Then we can use above command

2)Another easy way is launch an application using GUI/by clicking the application At the same time take logs using "adb logcat".

ActivityManager(1132): Starting activity: Intent { cmp=com.android.providers.subscribedfeeds/com.android.settings.ManageAccountsSettings }

ActivityManager(1132): Displayed activity  com.android.providers.subscribedfeeds/com.android.settings.ManageAccountsSettings :500 ms


 we can launch this activity from commandline as below:

 adb shell am start -a android.intent.action.MAIN -n 
com.android.providers.subscribedfeeds/com.android.settings.ManageAccountsSettings
 

No comments: