TechPosts

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:

  1. It effectively allows writing a virus.
  2. It's disallowed by Apple/Microsoft.
  3. It consumes battery even when the app isn't running.

Therefore, we have implemented APIs for some of the commonly used background services:

  1. Background Location updates for monitoring significant location changes.
  2. Background Data updates for periodically polling a data source for updates while the app is in the background.