Skip to content

Android Data Management with ADB and Content Providers

Unlock the full potential of Android's Content Provider system using ADB commands. This detailed guide is designed for developers and tech enthusiasts who want to gain deeper insights into managing system settings, querying databases, and manipulating data with precision. Whether you're adjusting system preferences, accessing contact information, or managing SMS and call logs, these commands provide the tools you need to interact with Android's underlying data systems efficiently. Elevate your Android management skills and streamline your data operations with these expert techniques.


Set ringtone from /sdcard/
adb shell 'content write --uri content://settings/system/ringtone_cache < /sdcard/wuseman/sounds/wuseman/molle_jobba_jobba.ogg'
Set ringtone to foo.ogg over adb from PC
adb shell 'content write --uri content://settings/system/ringtone_cache' < host.ogg

Query settings for system

adb shell content query --uri content://settings/system/

View sim info by slot

adb shell content query --uri content://com.sec.ims.settings/global#simslot/1

Set vibrator for specifik settings/profile

adb shell content query --uri content://com.android.settings.personalvibration.PersonalVibrationProvider

List all names of secure settings

adb shell content query --uri content://settings/secure/ | awk -F "[=,]" '{print "adb shell content query --uri content://system/settings/"$4}'

Query all settings with gnu parallel

echo -e "secure\nsystem\nglobal"| parallel -k -j3 "adb shell content query --uri content://settings/{}"

Disable developer mode

adb shell content update --uri content://settings/global --where "name='development_settings_enabled'" --bind value:s:0

Add new setting with content

adb shell content insert --uri content://settings/secure --bind name:s:oem_unlock_allowed --bind value:s:1

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'"

Status for developer mode

adb shell content query --uri content://settings/global --where "name='development_settings_enabled'"

Status for developer mode

content query --uri content://settings/global --where "name='development_settings_enabled'"

Find contents in sdk map and create samples for this cheatsheet

adb shell "su -c content query --uri content://com.samsung.rcs.autoconfigurationprovider/root/* |tr ' ' '\n'"
adb shell "su -c content query --uri content://com.samsung.rcs.autoconfigurationprovider/root/application/1/im/fthttpcsuser"

Delete a certain setting

adb shell content delete --uri content://settings/secure --where "name='new_setting'"

Insert a setting and value to foo

adb shellcontent insert --uri content://settings/secure --bind name:s:user_setup_complete --bind value:s:1

Change setting to another setting

adb shell content update --uri content://settings/secure --bind value:s:newer_value --where "name='new_setting'

Read will be able to read all kind of file extensions like zip, mp3 etc

adb shell 'content read --uri content://settings/system/ringtone_cache' > foo.ogg
adb shell content gettype --uri content://media/internal/audio/media/

Below will print all nbames and mmsproxy

adb shell su -c content query --uri content://telephony/carriers/sim_apn_list --projection name:mmsproxy
adb shell content query --uri content://com.android.shell.heapdump/
adb shell content query --uri content://call_log/calls
adb shell content query --uri content://call_log_shadow/calls
adb shell content query --uri content://call_log/calls/filter
adb shell content query --uri content://call_log/calls
adb shell content query --uri content://downloads/my_downloads
adb shell content query --uri content://downloads/all_downloads
adb shell content query --uri content://downloads/
adb shell content query --uri content://my.app/live
adb shell content query --uri content://sms-changes
adb shell content query --uri content://sms
adb shell content query --uri content://sms/inbox
adb shell content query --uri content://sms/sent
adb shell content query --uri content://sms/draft
adb shell content query --uri content://sms/outbox
adb shell content query --uri content://sms/conversations
adb shell content query --uri content://carrier_information/carrier
adb shell content query --uri content://mms-sms/threadID
adb shell content query --uri content://mms
adb shell content query --uri content://mms/inbox
adb shell content query --uri content://mms/sent
adb shell content query --uri content://mms/drafts
adb shell content query --uri content://mms/outbox
adb shell content query --uri content://mms-sms/
adb shell content query --uri content://mms-sms/conversations
adb shell content query --uri content://mms-sms/messages/byphone
adb shell content query --uri content://mms-sms/undelivered
adb shell content query --uri content://mms-sms/draft
adb shell content query --uri content://mms-sms/locked

Priint serach results for mms via sms

adb shell content query --uri content://mms-sms/search
adb shell su -c content query --uri content://telephony/carriers
adb shell su -c content query --uri content://telephony/carriers/sim_apn_list --projection name:mmsproxy
adb shell content query --uri content://telephony/carriers/dpc
adb shell content query --uri content://telephony/carriers/filtered
adb shell content query --uri content://telephony/carriers/enforce_managed
adb shell content query --uri content://telephony/carriers/preferapn/subId
adb shell content query --uri content://telephony/carriers/preferapnset/subId
adb shell content query --uri content://cellbroadcasts
adb shell content query --uri content://cellbroadcasts/history
adb shell content query --uri content://cellbroadcast-legacy
adb shell content query --uri content://service-state/
adb shell content query --uri content://carrier_id
adb shell content query --uri content://carrier_id/all
adb shell content query --uri content://telephony/siminfo
adb shell content query --uri content://contacts/settings

Contact list

adb shell content query --uri content://contacts/people
adb shell content query --uri content://contacts/people/filter
adb shell content query --uri content://contacts/deleted_people
adb shell content query --uri content://contacts/people/with_email_or_im_filter
adb shell content query --uri content://contacts/groups
adb shell content query --uri content://contacts/deleted_groups
adb shell content query --uri content://contacts/phones
adb shell content query --uri content://contacts/phones/filter
adb shell content query --uri content://contacts/groupmembership
adb shell content query --uri content://contacts/groupmembershipraw
adb shell content query --uri content://contacts/contact_methods
adb shell content query --uri content://contacts/contact_methods/email
adb shell content query --uri content://contacts/presence
adb shell content query --uri content://contacts/organizations
adb shell content query --uri content://contacts/photos
adb shell content query --uri content://contacts/extensions

Get google contacts with full info

adb shell content query --uri content://com.android.contacts/data --projection display_name:data1:data4:contact_id

Get google contacts and print notes for every contact

adb shell content query --uri content://contacts/phones/  --projection display_name:number:notes
adb shell content query --uri content://contacts/people/

Count people in contact list

adb shell bash content query --uri content://contacts/people/ |wc -l

List the phone numbers

adb shell content query --uri content://contacts/phones/

List the groups

adb shell content query --uri content://contacts/groups/

List group membership

adb shell content query --uri content://contacts/groupmembership/

List organizations

adb shell content query --uri content://contacts/organizations/

Trick device that setup already has been done (FRP Bypassing)

adb shellcontent insert --uri content://settings/secure --bind name:s:user_setup_complete --bind value:s:1

adb shell am start -n com.google.android.gsf.login/

adb shell am start -n com.google.android.gsf.login.LoginActivity

Dump global settings

adb shell content query --uri content://settings/global

Dump secure settings

adb shell content query --uri content://settings/seure
adb shell content query  --uri content://media/external/file  --projection _data

Query secure settings 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

Remove "new_setting" secure setting

adb shell content delete  --uri content://settings/secure --where "name='new_setting'"

Download current ringtone and play on PC via ffplay:

content read  --uri content://settings/system/ringtone_cache' > a.ogg  |xargs ffplay a.ogg

Auto rotation on

adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:1

Auto rotation off

adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0

Rotate to landscape

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1

Rotate portrait

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0