方便测试的 adb 命令 集合

来源:互联网 发布:关于初中英语的软件 编辑:程序博客网 时间:2024/06/01 10:47
To Get Apk from package infor
$adb shell pm path com.android.bluet

To turn on bluetooth -
$adb shell am start -a android.bluetooth.adapter.action.REQUEST_ENABLE

To open wifi-
$adb shell am start -n com.android.settings/.wifi.WifiSettings

To fetch wifi info -
$adb shell am start -n com.android.settings/.wifi.WifiInfo

To fetch wifi status -
$adb shell am start -n com.android.settings/.wifi.WifiStatusTest

To open language settings -
$adb shell am start -n com.android.settings/.LanguageSettings

To open development option -
$adb shell am start -n com.android.settings/.DevelopmentSettings

To open dateTime set-up
$adb shell am start -n com.android.settings/.DateTimeSettingsSetupWizardooth

To send gmail with subject and body to specific recipients
$adb shell am start -n com.google.android.gm/com.google.android.gm.ComposeActivityGmail -d email:address@destination.com --es subject 'Your subject goes here' --es body 'Your email body goes here'

$adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name '"+name+"' -e phone "+number+"")

To enable wifi
$ adb shell svc wifi enable

To disable wifi
$ adb shell svc wifi disable

To enable bluetooth
$adb shell service call bluetooth_manager 6

To enable Airplane mode

$adb shell settings put global airplane_mode_on 1  
$adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true

To disable Airplane mode
$adb shell settings put global airplane_mode_on 0  
$adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false

To launch Settings item (refer to link https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml)

$adb shell am start -a android.intent.action.POWER_USAGE_SUMMARY

You can find the intents by looking at the <action> tags in the AndroidManifest.xml file for the Settings "application" (which can be viewed on GitHub). As an example, here is the activity definition for the Settings$PowerUsageSummaryActivity:

<activity android:name="Settings$PowerUsageSummaryActivity"
        android:label="@string/power_usage_summary_title"
        android:uiOptions="none"
        android:taskAffinity=""
        android:excludeFromRecents="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <action android:name="android.intent.action.POWER_USAGE_SUMMARY" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="com.android.settings.SHORTCUT" />
    </intent-filter>
    <!-- Some other stuff here... -->
</activity>
To get all gmail account information
/data/data/com.google.android.gm/database/gmail.db
1 0
原创粉丝点击