adb shell content命令调试数据库(查看MediaProvider数据库记录)

adb shell 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, n - null
  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>

usage: adb shell content read --uri <URI> [--user <USER_ID>]
  Example:
  adb shell 'content read --uri content://settings/system/ringtone_cache' > host.ogg

usage: adb shell content write --uri <URI> [--user <USER_ID>]
  Example:
  adb shell 'content write --uri content://settings/system/ringtone_cache' < host.ogg

usage: adb shell content gettype --uri <URI> [--user <USER_ID>]
  Example:
  adb shell content gettype --uri content://media/internal/audio/media/

例子:

把MediaProvider媒体库的external.db数据库的file表的数据打印出来
$ adb shell content query --uri content://media/external/file > D:\media_provider_external_file_table.txt

$ adb shell content query --uri content://media/external/images/media

MediaProvider媒体库的internal.db数据库
$ adb shell content query --uri content://media/internal/audio/media

$ adb shell content query --uri content://media/internal/audio/media/99

C:\Users\luoqingyan>adb shell
:/ $ su
:/ # content query --uri content://media/external/file --where "_data='/storage/emulated/0/DCIM/Camera'"

更数据库的字段例子:
$ adb shell
$ content query --uri content://media/external/file --where _data="'/storage/emulated/0/DCIM/Camera/d4fc6c4c273b2ce2406533de0655ad76.mp4'"
把datetaken的字段值改成0
$ adb shell content update --uri content://media/external/file --bind datetaken:l:0 --where _data="'/storage/emulated/0/DCIM/Camera/d4fc6c4c273b2ce2406533de0655ad76.mp4'"
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值