android - how to find the name of the main activity of an application?

前端 未结 5 1142
既然无缘
既然无缘 2020-12-16 19:50

For example, I want to start Gmail in code/command line, but I don\'t know its main activity name.

am start -n com.google.android.gm/.XXXXX

5条回答
  •  渐次进展
    2020-12-16 20:25

    You can plug your phone into the computer and look at the DDMS log, application launches are printed there, e.g:

    05-11 09:19:15.725: INFO/ActivityManager(96): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x2000000 cmp=com.google.android.gm/.ConversationListActivity bnds=[125,410][235,540] } from pid 2457
    

    So, com.google.android.gm/.ConversationListActivity, would seem like the right choice, at least, that's what the icon seems to launch.

提交回复
热议问题