Android Question When to use a Service

Markos

Well-Known Member
Licensed User
Longtime User
Hi All

There are aspects of B4X I have not yet found a use as yet. The Service module. Can some explain when and why to use this feature. I can assume it isnto run methods or events as a background process. If that is the case Im wondering what are the benefits of using a usual module using timer events?
 
Upvote 0
You should call Service.StartForeground if you want your service to always run in the background.
Thanks Erel.

What is the best option in my use case ?
My service connects to a server every 5 seconds.
Use a timer and let the service running, or Start/Stop the service every 5 seconds with StartServiceAt and StopService?
 
Upvote 0
Back
Top