加入收藏 | 设为首页 | 会员中心 | 我要投稿 厦门站长网 (https://www.0592zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

Android Native 应用程序启动 Activity 的技巧

发布时间:2021-11-30 12:36:01 所属栏目:教程 来源:互联网
导读:调用 /system/bin/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 INT
调用 /system/bin/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
 
    <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>]
 
am 的源代码在 frameworks/base/cmds/am/src/com/Android/commands/am 下面,是基于 Java 的,由于里面直接使用了 IActivieManager,Intent 等 Java 类,因此不能直接移植到 native code,留待以后研究。

(编辑:厦门站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读