Sub DeviceInfo_Fetch
dvcDeviceID = GetDeviceID
dvcManufacturer = ph.Manufacturer
dvcModel = ph.Model
dvcProduct = ph.Product
dvcSdkVersion = ph.SdkVersion
dvcOSVersion = GetOSVersion
dvcAndroidID = ph.GetSettings("android_id")
dvcSQLiteVersion = GetSQLVersion
dvcIPAddress = GetIPAddress
End Sub
Sub GetDeviceID As String
Dim id As String
Dim rf As Reflector
Dim Api As Int
Api = rf.GetStaticField("android.os.Build$VERSION", "SDK_INT")
If Api < 9 Then
'old device
id = ph.GetSettings("android_id")
Else
'new device
id = rf.GetStaticField("android.os.Build", "SERIAL")
If id.ToLowerCase = "unknown" Then id = ph.GetSettings("android_id")
End If
Return id
End Sub
Sub GetOSVersion As String
Dim OS As String
Select dvcSdkVersion
Case 2 : OS = "1.1"
Case 3 : OS = "1.5"
Case 4 : OS = "1.6"
Case 5 : OS = "2.0"
Case 6 : OS = "2.0.1"
Case 7 : OS = "2.1"
Case 8 : OS = "2.2"
Case 9 : OS = "2.3"
Case 10 : OS = "2.3.x" '2.3.3 or 2.3.7
Case 11 : OS = "3.0"
Case 12 : OS = "3.1"
Case 13 : OS = "3.2.x"
Case 14 : OS = "4.0.x"
Case 15 : OS = "4.0.3"
Case 16 : OS = "4.1.x"
Case 17 : OS = "4.2.x"
Case 18 : OS = "4.3.x"
Case 19 : OS = "4.4.x"
Case 21 : OS = "5.0"
Case 22 : OS = "5.1"
Case 23 : OS = "6.0"
Case 24 : OS = "7.0"
Case 25 : OS = "7.1"
Case Else : OS = ">7.1"
End Select
Return OS
End Sub
Sub GetSQLVersion As String
Dim cur As Cursor
Dim V As String = ""
cur = Main.SQLcn.ExecQuery("SELECT sqlite_version() as sqlite_version")
If cur.RowCount > 0 Then
cur.Position = 0
V = cur.GetString2(0)
End If
cur.Close
Return V
End Sub
Sub GetIPAddress As String
Dim ip As String = ""
Dim jo As JavaObject
jo.InitializeContext
ip = jo.RunMethod("getIp", Array("wlan0"))
Return ip
End Sub