Yes, You can do this if you have root access. Its a lengthy process but you can do this :
Step 1: copy settings.db
from /data/data/com.android.providers.settings/databases/
using RootBrowser
from the device and than change the value using sqliteBrowser
which you want to update than update settings.db and put in assets
package of your project
Step 2: Copy this file into your application folder (anywhere where you can access) using asset manager
for that you need
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
this function will copy file from assets
public static void copyAssets(Context context, String assetPath, String outFilename) {
AssetManager assetManager = context.getAssets();
InputStream in = null;
OutputStream out = null;
try {
in = assetManager.open(assetPath);
File outFile = new File(context.getExternalFilesDir(null), outFilename);
out = new FileOutputStream(outFile);
copyFile(in, out);
} catch (IOException e) {
Log.e(TAG, "Failed to copy asset: " + outFilename, e);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
}
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
}
}
}
}
public static void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
}
Step 3: overwrite the system settings.db
file system path (destPath) is /data/data/com.android.providers.settings/databases/
public static void copyToSystem(final String sourceFilePath, final String destPath) {
Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
//
os.writeBytes("cp -f " + sourceFilePath + " " + destPath + "\n");
os.flush();
os.writeBytes("exit\n");
os.flush();
process.waitFor();
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
Log.e(TAG, e.toString());
} catch (IOException e) {
e.printStackTrace();
Log.e(TAG, e.toString());
}
}
});
background.start();
}
Step 4: Reboot device
That's all done.