转自:http://blog.chinaunix.net/uid-22041485-id-2680744.html

1、进入cmd


2、输入adb shell

3、输入sqlite3 数据库名称



Android saved settings in a database file which is /data/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_provisi one d" as an example.


Android use sqlite3 as the database. So we can use sqlite3 to manage the database file.
$sqlite3 /data/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_devicesfavorites 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,'mute_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','60000');

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_notification_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','102');


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'; eko]

You can type ".dump system" again to check whether the modification is valid.

更多相关文章

  1. Android 官方数据库Room --- 配置
  2. Android配置打包名称
  3. 【Android】数据库 sqLite
  4. 【Java转Android】30. LitePal操作SQLite数据库
  5. Android SQLite数据库相关操作
  6. android 自带的contacts2.db数据库表结构脚本
  7. Android Sqlite数据库中判断某个表是否存在的SQL语句
  8. Android中使用SQLite数据库详解

随机推荐

  1. android 修改AVD的存放位置
  2. 范例解析:学习Android的IPC主板模式
  3. Android如何实现获取短信验证码的功能
  4. 酷炫的Android(安卓)QQ 开源了吧!!
  5. 使用jni接口完成android本地程序的运行--
  6. 抛砖引玉,谈谈Android移植到现有硬件平台
  7. 面向大众的移动技术:签名,封装和发布Andro
  8. android实现防美拍点赞效果
  9. Android之LinearLayout线性布局
  10. android学习