从命令行查询Android内容提供程序(adb shell)

编程入门 行业动态 更新时间:2024-10-27 18:24:00
本文介绍了从命令行查询Android内容提供程序(adb shell)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有一个根据意图启动活动的命令: am start 。另外要发送广播:上午广播。

There is a command to start an activity based on intent: am start. Also to send a broadcast: am broadcast.

我认为可能应该有一个shell命令来查询内容提供商,大概是这样的:

I think probably there should be a shell command to query a content provider, probably something like:

query content://com.myapp.authority/path --where 'column=?' --arg 1 --order 'column desc'

或类似。

有一个吗?

推荐答案

有一个 content 命令:

usage: adb shell content [subcommand] [options] usage: adb shell content insert --uri <URI> [--user <USER_ID>] --bind <BINDING> [--bind <BINDING>...] <URI> a content provider URI. <BINDING> binds a typed value to a column and is formatted: <COLUMN_NAME>:<TYPE>:<COLUMN_VALUE> where: <TYPE> specifies data type such as: b - boolean, s - string, i - integer, l - long, f - float, d - double Note: Omit the value for passing an empty string, e.g column:s: Example: # Add "new_setting" secure setting with value "new_value". adb shell content insert --uri content://settings/secure --bind name:s:new_setting --bind value:s:new_value usage: adb shell content update --uri <URI> [--user <USER_ID>] [--where <WHERE>] <WHERE> is a SQL style where clause in quotes (You have to escape single quotes - see example below). Example: # Change "new_setting" secure setting to "newer_value". adb shell content update --uri content://settings/secure --bind value:s:newer_value --where "name='new_setting'" usage: adb shell content delete --uri <URI> [--user <USER_ID>] --bind <BINDING> [--bind <BINDING>...] [--where <WHERE>] Example: # Remove "new_setting" secure setting. adb shell content delete --uri content://settings/secure --where "name='new_setting'" usage: adb shell content query --uri <URI> [--user <USER_ID>] [--projection <PROJECTION>] [--where <WHERE>] [--sort <SORT_ORDER>] <PROJECTION> is a list of colon separated column names and is formatted: <COLUMN_NAME>[:<COLUMN_NAME>...] <SORT_ORDER> is the order in which rows in the result should be sorted. Example: # Select "name" and "value" columns from secure settings where "name" is equal to "new_setting" and sort the result by name in ascending order. adb shell content query --uri content://settings/secure --projection name:value --where "name='new_setting'" --sort "name ASC" usage: adb shell content call --uri <URI> --method <METHOD> [--arg <ARG>] [--extra <BINDING> ...] <METHOD> is the name of a provider-defined method <ARG> is an optional string argument <BINDING> is like --bind above, typed data of the form <KEY>:{b,s,i,l,f,d}:<VAL>

更多推荐

从命令行查询Android内容提供程序(adb shell)

本文发布于:2023-10-07 14:50:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469686.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令行   程序   内容   shell   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!