I see in the logs that the Starter service is created and started when the app is run.
I've also seen that sometimes the Starter service is also stopped by the OS while the app is still running (maybe when it's in background, I haven't traced the actual condition)
My question is: once the Starter service is stopped, it will remain stopped, or is there any event that may cause it to be started again?
The reason behind my question is the initialization code I'm putting in Service_Start: I don't want it to be executed again while the app is still running, and I must be sure that Service_Start won't be invoked again.
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...
The reason behind my question is the initialization code I'm putting in Service_Start: I don't want it to be executed again while the app is still running, and I must be sure that Service_Start won't be invoked again.
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...
I rephrase my question: I do not need the Starter service to be continuosly running, I just need to be sure that it's not started again after the system stop it
If the system stops the starter service, your app is in fact "killed" and so next time you run it, the Activity_Create(FirstTime As Boolean) will be true, so all the initialization will occur.
Again, you can either test if firsttime is false, which will mean the app is comming from the background to the foreground, and/or if a particular view is already inilialized, in order to prevent doing it again
Update: Starting from B4A v8.3 the starter service will never be killed unless the whole process is killed. This means that you can always assume in your code that the starter service is running.
It is done internally by changing the starter service context to the application context.
exactly, but its easy to check. as I said, if the service is destroyed and the app is in background, then the next time it runs "FirstTime" value will be true