Activity Manager Start Option

Viewed 41

In this command :

adb shell am start -a com.example.package/com.example.package.ActivityName

What does the -a mean? I am seeing it as a start option but I can't seem to find any explanation from googling what the -a and sometimes I see a -n option as well.

I would expect this site to have all the explanations but if it does I can not locate it. https://developer.android.com/studio/command-line/adb

1 Answers

First of all your command won't work with -a argument as it has no action defined. :)

  • -a means action, for ex: -a android.intent.action.VIEW
  • -c means category, for ex: -c android.intent.category.BROWSABLE
  • -d means deeplink, for ex: -d "example:iamdeeplink"
  • -n means FLAG_ACTIVITY_NEW_TASK, so it will create a new task and launch your Activity there even though you might already have it running. It will start it from scratch.
  • Leaving -n argument out, would bring the task with your the Activity to the foreground if it exists, if not it will create a new one.
Related