Some commands for app operation

Source: Internet
Author: User

The operation is done under Windows and can be connected to the physical phone or simulator after the Android SDK is installed.

1. View connected phone or simulator

ADB devices

The results are as follows:

2. Check the package name and activity of an app

ADB logcat|find "Start" (adb logcat|grep start if under Linux or Apple computers)

The results are as follows:

The com.meizu.flyme.calculator behind the CMP is the name of the mobile phone's calculator package, and the. Calculator for its corresponding activity

3. Launch the App

ADB shell am start-w-N package/activity

Here is an example of a calculator:

Thistime is time-consuming for this startup

The app launch test is actually compared to other similar apps and the previous version of the app, is the startup time getting longer? Is there any possibility of optimization?

4. Close the app (cold start)

ADB Shell AM force-stop Package

Here is an example of a calculator:

5. Close the app (hot start)

ADB shell Input KeyEvent 3

The results of the implementation are as follows:

This way off, in fact, the app is transferred to the background, the start of the time in the foreground display, boot time is certainly faster than cold start

6. CPU Usage in app usage

ADB shell Dumpsys cpuinfo|find "Com.meizu.flyme.calculator"

The results of the implementation are as follows:

This app is used in the previous situation

7. App usage Data traffic situation

adb shell ps|find "com.meizu.flyme.calculator"---this will get the app's process ID (ie PID)

adb shell cat/proc/$pid/net/dev---using PID to get traffic usage

Implementation is as follows:

The inside of the LO network port traffic is local traffic does not need statistics

8. Check the battery status

adb shell Dumpsys Battery

Implementation is as follows:

The current charge is in the red box

The test is meant to use the usage of the app and compare it with other/previous versions

9. Change the phone to non-charging status

adb shell Dumpsys Battery status Set 1

The results of the implementation are as follows:

Some commands for app operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.