Hi,
I do have trouble getting my service to work on Andriod 8.0.0 and B4A v8.50.
I need to check every 2 minutes. This works fine with App visible. Also with App visible and Phone still alive, but pressing the power button this doesn't work anymore.
Part of my code:
Do I need more, like a Phonewakestatus/keepalive or something?
I read a lot of chats, but cannot find what I was looking for.
Can somebody help?
Best regards,
André
I do have trouble getting my service to work on Andriod 8.0.0 and B4A v8.50.
I need to check every 2 minutes. This works fine with App visible. Also with App visible and Phone still alive, but pressing the power button this doesn't work anymore.
Part of my code:
B4X:
#Region Service Attributes
#StartAtBoot: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Service_Create
'This is the program entry point.
'This is a good place to load resources that are not specific to a single activity.
Service.AutomaticForegroundMode=Service.AUTOMATIC_FOREGROUND_ALWAYS
End Sub
Sub Service_Start (StartingIntent As Intent)
'schedule the service to start every 2 minutes. Note that StartAtBoot is set to true
StartServiceAtExact(Me, DateTime.Now + 2 * DateTime.TicksPerMinute, True) 'om de 2 minuten
If(EigenFuncties.Internet=True) Then OphalenMessages
Service.StopAutomaticForeground
End Sub
Sub Service_TaskRemoved
'This event will be raised when the user removes the app from the recent apps list.
End Sub
'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub Service_Destroy
End Sub
.........
Do I need more, like a Phonewakestatus/keepalive or something?
I read a lot of chats, but cannot find what I was looking for.
Can somebody help?
Best regards,
André