#Region Service Attributes
#StartAtBoot: True
#End Region
Sub Process_Globals
Private nid As Int = 1
Private lock As PhoneWakeState
Private BR As BroadCastReceiver
End Sub
Sub Service_Create
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER 'we are handling it ourselves
lock.PartialLock
BR.Initialize("BroadcastReceiver")
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StartForeground(nid, CreateNotification("..."))
StartServiceAt(Me, DateTime.Now + 30 * DateTime.TicksPerMinute, True)
BR.addAction("android.intent.action.PTT.down")
BR.addAction("android.intent.action.PTT.up")
BR.SetPriority(998)
BR.registerReceiver("")
Log("Service start Ok")
End Sub
Sub CreateNotification (Body As String) As Notification
Dim notification As Notification
notification.Initialize2(notification.IMPORTANCE_LOW)
notification.Icon = "icon"
notification.SetInfo("PTT", Body, Main)
Return notification
End Sub
Sub Service_Destroy
lock.ReleasePartialLock
End Sub
Sub BroadcastReceiver_OnReceive (Action As String)
ToastMessageShow(Action,False)
Log(Action)
'can only abort when sendOrderedbroadcast Is called.
'BR.AbortBroadcast
End Sub