In order to track in the background, I see according to the tutorial that the notification is necessary, and if I remove that part of the code, then the tracking no longer works.
My question is, is there any other way I can do this? How does Waze do it in the background for example? without showing that notification?
I don't want the user to see that notification.
My question is, is there any other way I can do this? How does Waze do it in the background for example? without showing that notification?
I don't want the user to see that notification.
B4X:
Sub Service_Start (StartingIntent As Intent)
'Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
Service.StartForeground(nid, CreateNotification("..."))
StartServiceAt(Me, DateTime.Now + 30 * DateTime.TicksPerMinute, True)
Track
End Sub
Sub CreateNotification (Body As String) As Notification
Dim notification As Notification
notification.Initialize2(notification.IMPORTANCE_LOW)
notification.Icon = "icon"
notification.Number=0
'notification.AutoCancel=True
notification.SetInfo("Tracking", Body, Main)
Return notification
End Sub