Sub Service_Create
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER
lock.PartialLock
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StartForeground(1, CreateNotification("..."))
StartServiceAt(Me, DateTime.Now + 10 * 10000, True)
End Sub
Sub Service_Destroy
lock.ReleasePartialLock
Service.StopAutomaticForeground
CancelScheduledService(Me)
End Sub
Sub CreateNotification (Body As String) As Notification
Dim notification As Notification
notification.Initialize2(notification.IMPORTANCE_LOW)
notification.Icon = "TrainClock36x36"
notification.Sound = False
notification.Vibrate = False
notification.SetInfo("Connected", Body, Main)
Return notification
End Sub