Tech tip of this week

Activity Manager in Android

Activity Manager will interact with overall activities running in the system.Using the Activity Manager, the Android System manages a stack of activities which are in different states (starting, running, paused, stopped, destroyed).

Package: android.app.ActivityManager


Source Code:

Android Source:
http://developer.android.com/reference/android/app/ActivityManager.html

Activity manager commands:

$ adb shell am
usage: am [start|instrument]
       am start [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
                [-c <CATEGORY> [-c <CATEGORY>] ...]
                [-e <EXTRA_KEY> <EXTRA_VALUE> [-e <EXTRA_KEY> <EXTRA_VALUE> ...]
                [-n <COMPONENT>] [-D] [<URI>]

1. Launch activity from command prompt
    adb shell am start -n <package>/.<Activity Name>

2. To terminate Application
    adb shell am kill <package name>
    adb shell am force-stop <package name>

3. To start service
    adb shell am startservice <package name>/.<service class>

No comments:

Post a Comment