Hi guys,
I runs this example on my phone : Android 9, EMUI 9.1, B4A 9.8
The app is suppose to runs forever but in my case, when phone slept for a few minutes, OS killed it.
I changed the codes at service start to runs again every 3 minutes
but no avail.
I believe it has something to do with power management in EMUI 9.1.
The default power management for all app in EMUI 9.1 are manage automatically.
If I change power management for this example application to manual and allow it to run in background, application runs as expected.
Is there a way to let service runs forever without a need to change power management's setting in the phone?
I runs this example on my phone : Android 9, EMUI 9.1, B4A 9.8
Background location tracking
Simple example of a foreground service that keeps the process running in the background. The current location is shown in the persistent notification. The app starts at boot and theoretically should run all the time. It also schedules itself to run with StartServiceAt. This can help in cases...
www.b4x.com
The app is suppose to runs forever but in my case, when phone slept for a few minutes, OS killed it.
I changed the codes at service start to runs again every 3 minutes
B4X:
Sub Service_Start (StartingIntent As Intent)
Service.StartForeground(nid, CreateNotification("..."))
StartServiceAt(Me, DateTime.Now + 3 * DateTime.TicksPerMinute, True) 'in the example it was 30'
Track
End Sub
I believe it has something to do with power management in EMUI 9.1.
The default power management for all app in EMUI 9.1 are manage automatically.
If I change power management for this example application to manual and allow it to run in background, application runs as expected.
Is there a way to let service runs forever without a need to change power management's setting in the phone?