please like & Subscribe our youtube channel
https://www.youtube.com/playlist?list=PLQzJncZC8PUwCTcniu_akzp0N0oDx7l1n
In this Blog, we will learn about different activity manager command. For this commands, we can know all information about any device application activities.
What is Activity manager commands
Activity manager commands are ADB shell commands which are use for any application Activity and these commands perform many actions with activity. This command is used to start an activity, stop any activity, broadcast any intent modify ant device screen properties and much more.
And syntax is.
am <command>
Activity manager commands start with am the syntax. The may include intent specification.
<intent> Specification includes these Flags:
-a: <ACTION>
-d :< DATA_URI>
-c :< CATEGORY>
-t :< MIME_TYPE>
-e :< EXTRA_KEY>
--es:<EXTRA_STRING_VALUE>
--esn: <EXTRA_KEY>
--ez: <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE>
-n :< COMPONENT>
-f: <FLAGS>
Start Activity command
If we want to start any activity from ADB commands so use start activity command for it.
ex: am start <package name>/.<activity name>
or
am start<intent>
1) open menu
1) open menu
This is command will open complete action menu of your device. For this, we pass access intent and start will initiate intent. We just need to know what kind of intent we need.
Ex: am start <Intent>
And the output of this command is below.
2) open web page
2) open web page
We can also open a web page directly using am start command.
Ex: am start http://www.google.com
And the output of this command is in below picture.
3) Current location
3) Current location
We can open the map and find out the current location of our device using this command.
Ex: am start geo: 0,0q=Delhi, India
And the output of this command is.
4) add delete or modify device contacts
You can also add, edit or view your device contacts.
Ex: am start content: //contacts/people
And the output of this command is below.
And we can add or create a contact using start command.
Ex: am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Android Auto' -e phone 1234567890
And the output of the command is.
5) calling
We can also make a call using start command.
Ex: am start -a android.intent.action.CALL -d tel:777
And out of this command is.
6) Start Service
From this command, we can start ant device service.
Ex: am startservice –n <package name>/.<service name>
Or
am startservice <Intent>
7) Kill package
Kill package command use to kill the whole package including all activity and service. This command kills all process in a package in safe mode and does not affect other processes.
Ex: am kill <package name>
8) Kill all services
This command kills all background services and taped up your device and efficiency.
Ex: am kill-all
9) Broadcast
This command use to access our device any broadcast receiver class.
Ex: am broadcast <package name>/.<name of broadcast>
Or
am broadcast <Intent>
10) Force Stop package
Force stop command uses to force stop any package.
Ex: am force-stop <package name>
11) Instrument
Instrument commands use to start monitoring with an instrument instance. These commands use to testing purpose of the device.
Ex: am instrument -w <test_package_name>/<runner_class>
Instrument commands use to start monitoring with an instrument instance. These commands use to testing purpose of the device.
Ex: am instrument -w <test_package_name>/<runner_class>
And component of package in form <test_package>/<runner class>. am instrument -w <test_package_nwhere <test_package_name> is the Android package name of your test application, and <runner_class> is the name of the Android test runner class you are using
-w flag use to Forces an instrument to wait until the instrumentation terminates before terminating itself.
-r flag use to view result in raw format.
-e<TEST_OPTIONS> flags use Provides testing options as key-value pairs.
We can test a class in three types
unitTests
functionTests
IntegrationTests
12) Debug app
We can debug the android application using the command.
Ex: as set-debug-app <package name>
13) Clear debug app
Clear debug app command use to clear debug data in a package.
Ex: am clear-debug-app
14) Monitor
Sometimes we may be got error in our programs like unfortunately crash or ANR (application not responding )
To check this command we use monitor command to resolve it.
Ex: am monitor [option]
15) Screen compact
In some time we may need to adjust package screen compatibility to adjust screen resolution compatibility so we use this command for this purpose or we need to control screen resolution.
Ex: am screen-compat [on|off] <package name>
16) change screen size
This command use to adjust device screen size according to user requirement.
Ex: am display-size<screen size in pixel>
17) Change screen density
This command change device screen display density.
Ex: am display-density<dpi>
No comments:
Post a Comment