ACTIVITY:
Sub Activity_Create(FirstTime As Boolean)
StartService(Service1)
End Sub
SERVICE1:
Sub Service_Create
'PUT SERVICE IN FOREGROUND STATE - SO THAT SERVICE WILL NOT BE KILLED BY OS
Log(" put service to foreground")
Dim sNotif As Notification
sNotif.Initialize
sNotif.Icon = "icon" ' empty string will cancel notification ...
sNotif.OnGoingEvent = True
sNotif.SetInfo("PD","Service Running",Main)
sNotif.Sound = False
sNotif.Vibrate = False
sNotif.Notify(1)
Service.StartForeground(1,sNotif)
End Sub
Sub Service_Start (StartingIntent As Intent)
'ENABLE GPS
If GPS1.GPSEnabled = False Then
ToastMessageShow("Please enable the GPS device", True)
StartActivity(GPS1.LocationSettingsIntent)
Else
GPS1.Start(1000,0) 'Listen to GPS with no filters
End If
End Sub
Sub Service_Destroy
GPS1.Stop
Log(" GPS1.Stop")
End Sub