1

The original documentation of the Codename One BackgroundFetch interface says: "include fetch in the ios.background_modes build hint". The build hints can be found in the Codename One simulator in the "Tools" menu. So I entered fetch in this field and saved. This will be written into file /appname-common/codenameone_settings.properties as codename1.arg.ios.background_modes=fetch

But it has no effect. Method public void performBackgroundFetch(final long deadline, final Callback<Boolean> onComplete) in class MyApp of my iOS enterprise app will never be called by iOS while the app is sleeping in background. My code is the same as in various examples I have found. Method start() in main class MyApp (which extends Lifecycle) includes

Display.getInstance().setPreferredBackgroundFetchInterval(300);
if (Display.getInstance().isBackgroundFetchSupported()) {
    log.p("Background fetching is supported");
}

Whenever I bring my app to front, it starts again with

[EDT] 0:0:0,167 - MyApp.start()
[EDT] 0:0:0,176 - Background fetching is supported
[EDT] 0:0:0,176 - MyApp.runApp()
etc.

What have I done wrong? What's missing?

Codename One 7.0.108 Apple iPhone 14 Pro Apple iOS 16.5.1

  • Did you look at the [thread here](https://groups.google.com/g/codenameone-discussions/c/Q4pwB28AG5I/m/tIsWgnOBDAAJ?pli=1)? Also check out [this answer](https://stackoverflow.com/a/62137379/756809). – Shai Almog Aug 02 '23 at 03:08

0 Answers0