Manually modify Android database data

Source: Internet
Author: User
Manually update settings in command line [first written by Steve Guo, please keep the mark if forwarding.]

Android saved settings in a database file which is/data/COM. android. providers. settings/databases/settings. DB. for some settings, Android does not support set them on the GUI. so we need find another way to set it. here it is. I will use set "device_provisioned" as an example.

Android use sqlite3 as the database. So we can use sqlite3 to manage the database file.

$ Sqlite3/data/COM. Android. providers. Settings/databases/settings. DB

The above command will open the settings database. Then you will enter into sqlite3 command line.

First we can check how many tables existed in the database. Here lists the result.

SQLite>. Tables
Android_metadata bookmarks gservices
Bluetooth_devices favorites System

The settings we try to set lies in "system" table, so then we list all items in the table to view the current table information.
SQLite>. Dump System
Begin transaction;
Create Table System (_ id integer primary key autoincrement, Name text unique on conflict replace, value text );
Insert into "system" values (3, 'Volume _ system', '5 ');
Insert into "system" values (4, 'Volume _ voice ', '4 ');
Insert into "system" values (5, 'Volume _ alarm ', '6 ');
Insert into "system" values (6, 'mode _ ringer ', '2 ');
Insert into "system" values (7, 'vibrate _ on', '4 ');
Insert into "system" values (8, 'mode _ ringer_streams_affected', '6 ');
Insert into "system" values (9, 'execute _ streams_affected', '14 ');
Insert into "system" values (10, 'dim _ screen', '1 ');
Insert into "system" values (11, 'stay _ on_while_plugged_in ', '0 ');
Insert into "system" values (12, 'screen _ off_timeout ', '123 ');
Insert into "system" values (13, 'airplane _ mode_radios ', 'cell, Bluetooth, WiFi ');
Insert into "system" values (14, 'airplane _ mode_on ', '0 ');
Insert into "system" values (15, 'bluetooth _ on', '0 ');
Insert into "system" values (16, 'usb _ mass_storage_enabled ', '1 ');
Insert into "system" values (17, 'wifi _ on', '0 ');
Insert into "system" values (18, 'wifi _ networks_available_icationication_on ', '1 ');
Insert into "system" values (19, 'network _ preference ', '1 ');
Insert into "system" values (20, 'Auto _ time', '1 ');
Insert into "system" values (21, 'screen _ brightness ', '123 ');
Insert into "system" values (23, 'window _ animation_scale ', '1 ');
Insert into "system" values (24, 'transition _ animation_scale ', '0 ');
Insert into "system" values (26, 'Data _ roaming ', '0 ');
Insert into "system" values (27, 'date _ format', 'Mm-dd-yyyy ');
Insert into "system" values (30, 'device _ provisioned', '0 ');
Insert into "system" values (31, 'location _ providers_allowed ', 'GPS ');
Insert into "system" values (32, 'Install _ non_market_apps ', '1 ');
Insert into "system" values (119, 'ringtone', 'content: // media/external/Audio/Media/11 ');
Insert into "system" values (243, 'Volume _ Music', '15 ');
Insert into "system" values (244, 'Volume _ music_last_audible ', '15 ');
Insert into "system" values (266, 'Volume _ ring', '7 ');
Insert into "system" values (267, 'Volume _ ring_last_audible ', '7 ');
Insert into "system" values (274, 'font _ scale', '1. 0 ');
Insert into "system" values (275, 'adb _ enabled', '0 ');
Insert into "system" values (276, 'next _ alarm_formatted ','');
Create index systemindex1 on system (name );
Commit;
Pay attention to the first line about table information. the text marked with red will be used when writting SQL statements. assume we want to set "device_provisioned" to 1, we can simply type the following statement in the sqlite3 console.
SQLite> Update "system" set value = '1' where name = 'device _ provisioned ';

You can type ". Dump System" again to check whether the modification is valid.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.