programmatically erase android browser cache, history, etc. with root

家住魔仙堡 提交于 2019-12-06 10:49:03

问题


I have an android tablet that is locked down (users will only be able to use standard issue android browser), so all the temporary internet stuff should be in the same place.

Assuming I am able to root the device sometime here soon, I would like to be able to wipe out (1) cookies,(2) temp internet files,(3) history,(4) form data,(5) location access info,(6) passwords, (7) cache.

I think I can knock out most of these by erasing:

/data/data/com.android.browser/cache

The cookies appear to be in a database. I'm not sure if I can just delete it

/data/data/com.android.browser/databases/webview.db

And then I think I can just delete these files to erase location information:

/data/data/com.google.android.location/files/wifi

/data/data/com.google.android.location/files/cell

Will that take care of everything?

What am I leaving out?

Is it safe to just erase that database? Does anyone know?


回答1:


how about something as simple as

adb shell pm clear com.android.browser 

from command line ?




回答2:


This API is deprecated in Android Marshmallow. If you build using API 23 it wont work any more.

You can delete them @micahhoover, You can delete complete com.android.browser sub directories, every time you relaunch browser, all the sub folders gets created.

To delete android browser History(Default)

in your Activity.java file add the follwing code

Browser.clearHistory(getContentResolver());

In your manifest add

<uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/>
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>


来源:https://stackoverflow.com/questions/7235741/programmatically-erase-android-browser-cache-history-etc-with-root

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!