Public Sub firstInstallTime(CallingActivity As Object, PackageName As String) As String
'PackageManager.getPackageInfo(packageName, 0).firstInstallTime;
tCallingActivity = CallingActivity
Dim pm As JavaObject
Dim pInfo As JavaObject
pm = GetContext.RunMethodJO("getPackageManager", Null)
pInfo = pm.RunMethod("getPackageInfo", Array(PackageName, 0) )
Dim unixtime As Long = pInfo.GetField("firstInstallTime")
Return GetDateFromUnixMilis(unixtime)
End Sub
Public Sub lastUpdateTime(CallingActivity As Object, PackageName As String) As String
'PackageManager.getPackageInfo(packageName, 0).firstInstallTime;
tCallingActivity = CallingActivity
Dim pm As JavaObject
Dim pInfo As JavaObject
pm = GetContext.RunMethodJO("getPackageManager", Null)
pInfo = pm.RunMethod("getPackageInfo", Array(PackageName, 0) )
Dim unixtime As Long = pInfo.GetField("lastUpdateTime")
Return GetDateFromUnixMilis(unixtime)
End Sub
Private Sub GetDateFromUnixMilis(UnixTimeMilis As Long) As String
Dim targetDate As Long = DateUtils.UnixTimeToTicks(UnixTimeMilis / 1000)
DateTime.DateFormat = "yyyy-MM-dd"
DateTime.TimeFormat = "HH:mm:ss"
DateTime.SetTimeZone(0)
Return (DateTime.Date(targetDate)) '25.03.2014
'Return (DateTime.Time(targetDate)) '10:52:50
End Sub
Private Sub GetContext As JavaObject
Return GetBA.GetField("context")
End Sub
Private Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = tCallingActivity
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetFieldJO("processBA")
End Sub