清除Android浏览器历史记录 [英] Clear Android Browser History

查看:218
本文介绍了清除Android浏览器历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的,这将有开放给客户看和玩几台设备在客户端的应用程序。他们希望能够清除定期浏览器历史记录,这样,如果一个客户打开浏览器,以不适当的网站下一个客户一起走就看不到这一点。

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?

我已经注意到,杀死浏览器的任务管理器自带的装置作品pre-加载。是杀了浏览器的任务,我可以把它关闭所有打开的标签的唯一途径?如果是的话我怎么能去杀人/重新启动浏览器进程?我试过这样的:

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.

推荐答案

我试图关闭通过ActivityManager的浏览器,它工作正常。我测试了在一个HTC 2.2和它的作品完美。

I tried to close the browser via the ActivityManager and it works fine. I tested this on an HTC 2.2 and it works perfect.

也许你也应该试试这个:

Maybe you should also try this:

am.killBackgroundProcesses("com.google.android.browser");

如果您的手机上的浏览器是不是在com.android.browser

in case the browser on your phone is not at com.android.browser

甚至试图完成的活动: com.android.browser.BrowserActivity

or even try to finish the activity: com.android.browser.BrowserActivity

希望这有助于!

这篇关于清除Android浏览器历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆