Sub Service_Create
client.Initialize
Blutooth.Initialize("Bluetooth")
If LOG_List.IsInitialized=False Then LOG_List.Initialize
LOG_List.Add(DateTime.Date(DateTime.Now) & " " & DateTime.Time(DateTime.Now))
LOG_List.Add("Starting " & Application.LabelName)
Log("Starting " & Application.LabelName)
Dim p As Phone
If p.SdkVersion >= 29 Then
rp.CheckAndRequest("android.permission.ACTIVITY_RECOGNITION")
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
LOG_List.Add(DateTime.Date(DateTime.Now) & " " & DateTime.Time(DateTime.Now))
LOG_List.Add("android.permission.ACTIVITY_RECOGNITION: " & Result)
If Result = False Then
ToastMessageShow("No permission", True)
Return
End If
End If
' Dim activities As List = Array("IN_VEHICLE", "ON_BICYCLE", "ON_FOOT", "STILL", "UNKNOWN", "TILTING", "", "WALKING", "RUNNING")
Dim activities As List = Array("IN_VEHICLE", "ON_BICYCLE", "ON_FOOT", "STILL", "WALKING", "RUNNING")
Wait For (client.RequestTransitionUpdates(activities)) Complete (Success As Boolean)
Log("RequestTransitionUpdates(activities): " & Success)
Crea_notifica("ActivityType:UNKNOWN", " TransitionType:UNKNOWN")
If Main.App_aperta Then
CallSub(Main,"Refresh_LOG")
End If
End Sub