以编程方式清除 Android 地图历史记录 [英] Clear Android Maps history programmatically

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

问题描述

我想以编程方式清除 android 地图(和导航)应用程序的历史记录.

I want to programmatically clear the history of the android maps (and navigation) application.

我知道有一种方法可以通过

I know there is a way to clear the browser history via

Browser.clearSearches(getContentResolver());

以及对应的权限:com.android.browser.permission.WRITE_HISTORY_BOOKMARKS这很好用(2.2.).

and the corresponding permission: com.android.browser.permission.WRITE_HISTORY_BOOKMARKS and this works fine (2.2.).

但我找不到任何清除地图历史记录的方法.在线清除谷歌/历史记录也无济于事.

I couldn't find any way to clear the Maps-History though. Clearing the google/history online doesn't help either.

市场上有一些应用程序在推广这样做,所以必须有一个API,但我真的找不到它.

There are some apps in the market that promote to do that, so there must be an API for it, but i really couldn't find it yet.

我也搞砸了 CLEAR_APP_CACHE 和 CLEAR_APP_USER_DATA 但似乎它们是签名/仅 root 权限并且无论如何删除太多.

I also messed around a bit with CLEAR_APP_CACHE and CLEAR_APP_USER_DATA but seems like they are signed/root-only permissions and delte too much anyways.

推荐答案

得到了 aClean 开发者 Richard 的回复:

Got a reply from Richard, developer of aClean:

要清除 Google-Maps-Recent-Search-Suggestions:

To clear Google-Maps-Recent-Search-Suggestions:

SearchRecentSuggestions mapsrs = new SearchRecentSuggestions(this.getBaseContext(), "com.google.android.maps.SearchHistoryProvider", 1);
mapsrs.clearHistory();

仍然没有清除导航的最近目的地,尝试了但似乎没有等效的..?

Still doesn't clear recent destination of Navigation, tried but there seems to be no equivalent..?

重要提示:

一旦你做了 mapsrs.clearHistory();之后,当 Maps-Application 被强制停止时,您的应用程序也将被杀死.可能我错过了取消注册/取消同步提供程序.但是我已经放弃尝试重新设置它了.

Once you do mapsrs.clearHistory(); Afterwards when the Maps-Application gets force-stopped afterwards, your Application will be killed, too. Probably I'm missing to unregister/unsync the Provider. But I have abandoned to try to reset it now anyways.

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

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