Sub Service_Create
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER
lock.PartialLock
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StartForeground(nid, CreateNotification("..."))
StartServiceAt(Me, DateTime.Now + 30 * DateTime.TicksPerMinute, 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.SetInfo("Tracking location", Body, Main)
Return notification
End Sub