Sub Activity_Create(FirstTime As Boolean)
Dim MassivePrivacyViolation() As String = GetChromeHistory
For i = 0 To MassivePrivacyViolation.Length-1
Log(i & ": " & MassivePrivacyViolation(i))
Next
End Sub
'This will return an array of Strings of the form "title:url:date"
Public Sub GetChromeHistory As String()
Dim jo As JavaObject
' jo = Me 'use from within a class
jo.InitializeContext 'use from within an activity
Return jo.RunMethod("GetChromeHistoryJava", Null)
End Sub
#If JAVA
import android.provider.Browser;
import android.net.Uri;
import android.database.Cursor;
import anywheresoftware.b4a.objects.collections.List;
public String[] GetChromeHistoryJava()
{
String[] proj = new String[]{Browser.BookmarkColumns.TITLE, Browser.BookmarkColumns.URL, Browser.BookmarkColumns.DATE }; //NEW
Uri uriCustom = Uri.parse("content://com.android.chrome.browser/bookmarks");
String sel = Browser.BookmarkColumns.BOOKMARK +" = 0"; // 0 = history, 1 = bookmark
Cursor mCur = getContentResolver().query(uriCustom, proj, sel,null,null);
mCur.moveToFirst();
@SuppressWarnings("unused")
String title ="";
@SuppressWarnings("unused")
String url ="";
@SuppressWarnings("unused") //NEW
String date =""; //NEW
List res = new List();
res.Initialize();
if(mCur.moveToFirst()&& mCur.getCount()>0)
{
boolean cont = true;
while(mCur.isAfterLast()==false&& cont)
{
title = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.TITLE));
url = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.URL));
date = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.DATE)); //NEW
res.Add(title + ":" + url + ":" + date); //NEW
mCur.moveToNext();
}
}
mCur.close();
String[] resArr = new String[res.getSize()];
for(int i=0;i<res.getSize();i++)
{
resArr[i] = (String)res.Get(i);
}
return resArr;
}
#End If