Search This Blog

Friday, October 11, 2013

Android - Find main activity name of the running application

Run as Android superuser:
adb shell dumpsys activity

This gives you the dump of all running activities. I wanted to find the activity name of the sftp server that was running in the background.

The line of interest was:

Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10104000 pkg=com.icecoldapps.httpsftpsserver cmp=com.icecoldapps.httpsftpsserver/.viewStart bnds=[145,610][345,787] }
      Hist #2: ActivityRecord{42d5cb18 com.icecoldapps.httpsftpsserver/.viewStart}
        Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10104000 pkg=com.icecoldapps.httpsftpsserver cmp=com.icecoldapps.httpsftpsserver/.viewStart bnds=[145,610][345,787] }
        ProcessRecord{42c29950 15592:com.icecoldapps.httpsftpsserver/u0a6} 

So the main activity name is:
.viewStart


I was able to remotely start the application by firing up the command:
adb shell su -c "am start -n "com.icecoldapps.httpsftpsserver/.viewStart""
( I needed superuser priviledges)

To start this Android application as a regular user enter:
adb shell am start -n "com.icecoldapps.httpsftpsserver/.viewStart"

To kill the application:
adb shell am force-stop com.icecoldapps.httpsftpsserver

To uninstall the application:
adb shell pm uninstall com.icecoldapps.httpsftpsserver

2 comments:

If you like this post, please leave a comment :)