以编程方式清除 Android 地图历史记录

编程入门 行业动态 更新时间:2024-10-22 11:21:06
本文介绍了以编程方式清除 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 地图历史记录

本文发布于:2023-10-28 01:07:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535050.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:历史记录   方式   地图   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!