-2

I'm developing a history clearing application, in which I want to clear my Google Map history.

How can I do this?

SearchRecentSuggestions mapsrs = new SearchRecentSuggestions(this.getBaseContext(),com.google.android.maps.SearchHistoryProvider", 1);
mapsrs.clearHistory();
  • 1
    What you can do is try something for yourself first – musefan May 29 '14 at 09:47
  • but it is cant work brother. this code is cant work on 4.0 @musefan – Hitesh patel May 29 '14 at 10:30
  • 1
    @Hiteshpatel: FYI, when you included code you should say what the problem with it is. In this case it is very important to state that it doesn't work in 4.0 and (presumably) higher. Include that information by editing your question – musefan May 29 '14 at 10:43

1 Answers1

2
 getPackageManager().clearPackagePreferredActivities(getPackageName());

FYI for getPackageName() you can give com.google.android.apps.maps

try this ...

Toppers
  • 559
  • 3
  • 11
  • getPackageManager().clearPackagePreferredActivities(getPackageName("com.google.android.maps.SearchHistoryProvider")); – Hitesh patel May 29 '14 at 10:40
  • clearPackagePreferredActivities(String packageName) we'll use getPackageName() if we want to get our app package name. So try with getPackageManager().clearPackagePreferredActivities("com.google.android.apps.maps"); – Toppers May 29 '14 at 10:56
  • also same problem. application is stope when i click on button. @Toppers – Hitesh patel May 29 '14 at 11:20
  • oh..but it works fine for me... ok can you checkout with this thread http://stackoverflow.com/questions/2583966/how-do-i-use-packagemanager-addpreferredactivity – Toppers May 29 '14 at 11:32
  • dear this is also not work. i m working on 4.0 @Toppers – Hitesh patel May 30 '14 at 11:37