Рассматривая исходный код Android, он не выглядит многообещающим для вас. Обратите внимание на то, что метод clearHistory ничего не делает больше, и canClearHistory соответственно всегда Retuns ложные
/**
* Returns whether there is any history to clear.
*
* @param cr The ContentResolver used to access the database.
* @return boolean True if the history can be cleared.
* @removed
*/
public static final boolean canClearHistory(ContentResolver cr) {
return false;
}
/**
* Delete all entries from the bookmarks/history table which are
* not bookmarks. Also set all visited bookmarks to unvisited.
*
* @param cr The ContentResolver used to access the database.
* @removed
*/
public static final void clearHistory(ContentResolver cr) {
}
Вот одни и те же методы в 5.1.1 r1, когда они были на самом деле функциональны:
public static final boolean More ...canClearHistory(ContentResolver cr) {
Cursor cursor = null;
boolean ret = false;
try {
cursor = cr.query(History.CONTENT_URI,
new String [] { History._ID, History.VISITS },
null, null, null);
ret = cursor.getCount() > 0;
} catch (IllegalStateException e) {
Log.e(LOGTAG, "canClearHistory", e);
} finally {
if (cursor != null) cursor.close();
}
return ret;
}
Удалить все записи из таблицы закладок/истории, которые не являются закладок. Также установите все посещенные закладки на невидимые. Требуется android.Manifest.permission Параметры: cr ContentResolver используется для доступа к базе данных.
public static final void More ...clearHistory(ContentResolver cr) {
deleteHistoryWhere(cr, null);
}
Вы получаете какую-либо ошибку ??? Если да, то отправьте логарифм. – Pankaj
У меня нет ошибки. Но это не очищает историю. – Gowtham
Разрешение удалено, чтобы читать и писать закладки выше Marshmallow (API> = 23) ссылаются на эту ссылку https://developer.android.com/intl/ko/about/versions/marshmallow/android-6.0-changes.html#behavior- закладка-браузер –