Hi, I've been using your example BeaconParser app https://www.b4x.com/android/forum/t...iscover-ibeacons-and-eddystone-beacons.61127/
I want to receive beacon data continuously from when a start button is pressed until a stop button is pressed even if the phone display turns off.
It works well when the phone display is on, stops receiving when the display turns off, then restarts when the phone wakes up.
I read I needed to create a new service module which I have done but I'm not sure what to do now. Can you give me some idea please.
Thank you
I want to receive beacon data continuously from when a start button is pressed until a stop button is pressed even if the phone display turns off.
It works well when the phone display is on, stops receiving when the display turns off, then restarts when the phone wakes up.
I read I needed to create a new service module which I have done but I'm not sure what to do now. Can you give me some idea please.
Thank you
B4X:
#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private nid As Int = 1
Private lock As PhoneWakeState
End Sub
Sub Service_Create
lock.PartialLock
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StartForeground(nid, CreateNotification("..."))
End Sub
Sub CreateNotification (Body As String) As Notification
Dim notification As Notification
notification.Initialize2(notification.IMPORTANCE_LOW)
notification.Icon = "icon"
notification.SetInfo("Scanning", Body, Main)
Return notification
End Sub
Sub Service_Destroy
lock.ReleasePartialLock
End Sub