I'm trying to develop an android application that could erase default browser's search history without rooting, but I'm stuck. Here is my source code
File file = new File("data/data/com.android.browser/databases/browser.db");
try {
String content = "";
if(!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write(content);
bw.close();
Toast.makeText(MainActivity.this, "History Deleted From Default Browser", Toast.LENGTH_LONG).show();
System.out.println("Done");
} catch (IOException e) {
e.printStackTrace();
}
As i know browser's history will be stored in "browser.db" file, i can able to clear history only if I change the permission of browser.db file in command prompt through adb shell like "chmod 777 data/data/com.android.browser/databases/browser.db" But i need to do it every time, i want to do this inside my application source code, I also tried Runtime.exec() methods to execute adb shell, actually History Eraser app can erase the history of default browser without root permission, Can any one please help me out in solving this mystery. Thanks in Advance.
system()call, but not sure that worksadb shell pm clear com.android.browserwithout rooting thensystem()call from jni will work i hope.