Background Execution in Codename One
Background execution in Codename One is handled by a small set of APIs, each with a specific purpose. When running code in the background of a mobile device, we can't simply implement a generic background "service" to do everything because:
- It effectively allows writing a virus.
- It's disallowed by Apple/Microsoft.
- It consumes battery even when the app isn't running.
Therefore, we have implemented APIs for some of the commonly used background services:
- Background Location updates for monitoring significant location changes.
- Background Data updates for periodically polling a data source for updates while the app is in the background.