Hi everyone, i'm taking a look to
@Erel example on Geofence
(
https://www.b4x.com/android/forum/t...ing-a-region-in-the-background.84767/#content).
I'm trying to change it in order to implement it as foreground service, in this way TEORICALLY the OS can't kill my process (after months i didn't achieve this result yet).
The problem is that i scheduled the geofencing service to start every 5 minutes and automaticforeground stops after he return a result, BUT this work only the first time, the second time it doens't respond.
I put this in Service_Create
lock.PartialLock
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER
This in Service_Start
Service.StartForeground(1, CreateNotification("Controllo..."))
StartServiceAtExact(Me, DateTime.Now + Freq*DateTime.TicksPerMinute, True)
+ the CreateNotification Sub
This at the end of the Service_Start
Service.StopAutomaticForeground
And this in Service_Destroy
The rest is the same as in the example linked before.
What's wrong?
I leave the project in the attached file.
Thank in advance