zoukankan      html  css  js  c++  java
  • (转)adb shell am 的用法

    原文地址:http://blog.csdn.net/fulinwsuafcie/article/details/8092459
     
    adb shell am 的功能

    adb shell am
    使用此命令可以从cmd控制台启动 activity, services;发送 broadcast等等:

    C:UsersAdministrator>adb shell am
    usage: am [subcommand] [options]

        start an Activity: am start [-D] [-W] <INTENT>
            -D: enable debugging
            -W: wait for launch to complete

        start a Service: am startservice <INTENT>

        send a broadcast Intent: am broadcast <INTENT>

        start an Instrumentation: am instrument [flags] <COMPONENT>
            -r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
            -e <NAME> <VALUE>: set argument <NAME> to <VALUE>
            -p <FILE>: write profiling data to <FILE>
            -w: wait for instrumentation to finish before returning

        start profiling: am profile <PROCESS> start <FILE>
        stop profiling: am profile <PROCESS> stop

        start monitoring: am monitor [--gdb <port>]
            --gdb: start gdbserv on the given port at crash/ANR

        <INTENT> specifications include these flags:
            [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
            [-c <CATEGORY> [-c <CATEGORY>] ...]
            [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
            [--esn <EXTRA_KEY> ...]
            [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
            [-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
            [-n <COMPONENT>] [-f <FLAGS>]
            [--grant-read-uri-permission] [--grant-write-uri-permission]
            [--debug-log-resolution]
            [--activity-brought-to-front] [--activity-clear-top]
            [--activity-clear-when-task-reset] [--activity-exclude-from-recents]
            [--activity-launched-from-history] [--activity-multiple-task]
            [--activity-no-animation] [--activity-no-history]
            [--activity-no-user-action] [--activity-previous-is-top]
            [--activity-reorder-to-front] [--activity-reset-task-if-needed]
            [--activity-single-top]
            [--receiver-registered-only] [--receiver-replace-pending]
            [<URI>]


    使用实例:
    如启动一个 Activity:

    格式:
    adb shell am start -n 包名/包名+类名(-n 类名,-a action,-d date,-m MIME-TYPE,-c category,-e 扩展数据,等)。
     
    实例1:
    C:UsersAdministrator>adb shell am start -n com.android.camera/.Camera
    Starting: Intent { cmp=com.android.camera/.Camera }
     
    实例2:(带extra 的 intent)
    C:UsersAdministrator>adb shell am start -n com.android.camera/.Camera -e abc hello
    Starting: Intent { cmp=com.android.camera/.Camera (has extras) }

    其中 extra 的 key 为 abc ,value 为字串 "hello"

    sdk adb 下载地址http://developer.android.com/index.html

  • 相关阅读:
    C#的扩展方法解析
    C#的Process类调用第三方插件实现PDF文件转SWF文件
    DotNet程序配置文件
    C#中的委托解析
    DotNet生成随机数的一些方法
    好久没玩laravel了,今天玩下Laravel项目迁移步骤
    关于WIN7下IE8IE7浏览器无法安装微信支付商户证书的解决方案
    dedecms5.7文章页替换掉特定标志的图片链接
    原生PHP和MYSQL练习登陆验证和查询数据到表格
    我眼中的如何成为一名合格的PHP高级开发工程师
  • 原文地址:https://www.cnblogs.com/hhhh2010/p/3666218.html
Copyright © 2011-2022 走看看