我愿执行一项申请,以获取和淡化违约浏览器历史,并将浏览器历史保存到Xml档案中。 但是,浏览器史在某些装置中并未保存成xml文档。
我已执行我的申请,要求将浏览器历史带上,以拯救Xml文档如下:
private void browserHistoryDOM() {
try{
File newxmlfile = new File("/sdcard/Xmlfiles/briwserHistory.xml");
newxmlfile.createNewFile();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.newDocument();
Element rootElement = document.createElement("root");
document.appendChild(rootElement);
Cursor mCur = managedQuery(Browser.BOOKMARKS_URI,Browser.HISTORY_PROJECTION, null, null, null);
mCur.moveToFirst();
if (mCur.moveToFirst() && mCur.getCount() > 0) {
while (mCur.isAfterLast() == false) {
Element em = document.createElement("bookmarkIdx");
em.appendChild(document.createTextNode(mCur.getString(Browser.HISTORY_PROJECTION_BOOKMARK_INDEX)));
rootElement.appendChild(em);
long callDate = Long.parseLong(mCur.getString(Browser.HISTORY_PROJECTION_DATE_INDEX));
SimpleDateFormat datePattern = new SimpleDateFormat ("dd-MM-yyyy/h:m:s:a");
datePattern.setTimeZone(TimeZone.getTimeZone("GMT"));
String date_str = datePattern.format(new Date(callDate));
Element em1 = document.createElement("dateIdx");
em1.appendChild(document.createTextNode(date_str));
rootElement.appendChild(em1);
Element em2 = document.createElement("idIdx");
em2.appendChild(document.createTextNode(mCur.getString(Browser.HISTORY_PROJECTION_ID_INDEX)));
rootElement.appendChild(em2);
Element em3 = document.createElement("titleIdx");
em3.appendChild(document.createTextNode(mCur.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX)));
rootElement.appendChild(em3);
Element em4 = document.createElement("urlIdx");
em4.appendChild(document.createTextNode(mCur.getString(Browser.HISTORY_PROJECTION_URL_INDEX)));
rootElement.appendChild(em4);
Element em5 = document.createElement("visitsIdx");
em5.appendChild(document.createTextNode(mCur.getString(Browser.HISTORY_PROJECTION_VISITS_INDEX)));
rootElement.appendChild(em5);
long searchDate = Long.parseLong(mCur.getString(Browser.SEARCHES_PROJECTION_DATE_INDEX));
SimpleDateFormat datePattern1 = new SimpleDateFormat ("dd-MM-yyyy/h:m:s:a");
datePattern1.setTimeZone(TimeZone.getTimeZone("GMT"));
String date_str1 = datePattern.format(new Date(searchDate));
Element em6 = document.createElement("searchDateIdx");
em6.appendChild(document.createTextNode(date_str1));
rootElement.appendChild(em6);
Element em7 = document.createElement("searchIdx");
em7.appendChild(document.createTextNode(mCur.getString(Browser.SEARCHES_PROJECTION_SEARCH_INDEX)));
rootElement.appendChild(em7);
Element em8 = document.createElement("truncateIdIdx");
em8.appendChild(document.createTextNode(mCur.getString(Browser.TRUNCATE_HISTORY_PROJECTION_ID_INDEX)));
rootElement.appendChild(em8);
Element em9 = document.createElement("truncateOldest");
em9.appendChild(document.createTextNode(mCur.getString(Browser.TRUNCATE_N_OLDEST)));
rootElement.appendChild(em9);
mCur.moveToNext();
}
}
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(newxmlfile);
transformer.transform(source, result);
} catch (Exception e) {
e.printStackTrace();
}
}
通过采用上述方法,一能够取得浏览器历史,并能够将数据节省到纸张上的xml文档中。 但是,在某些种类的甲状腺装置中,还没有完成浏览器历史,也没有将其保存到Xml档案中。 如果我对摩托罗拉·德波塔装置的 app子进行了检测,那么它就会被罚款。 但是,如果我测试一下我身上的同一数字,就在Npm702NOVO7PALADIN上测试了,那么我无法在我的Xml档案中取得浏览器历史。