I am writing an application for a client that will have several devices that are open to customers to look at and play with. They want to be able to clear the browser history on a regular basis so that if a customer opens the browser to an inappropriate web site the next customer to come along will not see this.
I am currently using this to clear the history and searches:
Browser.clearHistory(getContentResolver());
Browser.clearSearches(getContentResolver());
This correctly clears the history. But any windows(tabs) that were open in the browser remain open. How can I tell the browser to close all of these tabs so that the next time someone opens the browser it will load the start page only?
I've noticed that killing the browser with the TaskManager that comes pre-loaded on the device works. Is killing the browser task the only way that I can get it to close any open tabs? If so how can I go about killing/restarting the browser process? I've tried this:
am = (ActivityManager) getApplicationContext().getSystemService(Activity.ACTIVITY_SERVICE);
am.killBackgroundProcesses("com.android.browser");
But this method doesn't seem to be doing anything. I do have
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"></uses-permission>
In my manifest but after I run this and go back to the browser it is still sitting on whatever tabs were left open. What is the proper way to use the permission that is granted by this?
Id rather find some way other than Task Kill to make it work, but at this point I am coming up empty on all fronts.