Ok might be finally making progress on this. The documentation says that the deadline is the time limit by which time the background fetch must be completed, it also mentions that its a 30 second limit, however in the implementation its hardcoded to send System.getTimeMillis() + 25 * 60 * 1000. Therefore relying on that deadline to manage what work can be done within the limit is wrong and will always fail and get killed by iOS.
Also I couldn't find an explanation or example of the boolean sent to onSuccess, turns out that it is true if you updated data (i.e., made a network call that updated something) and false if not. Calling true all the time when nothing was actually updated gets the task killed by iOS. I'd suggest that the iOS implementation is updated to send 30 seconds back instead of 60.025 seconds and that the documentation is updated to explain the difference between true and false in the success callback. I think its more reliable now, will continue testing. On Tuesday, August 23, 2016 at 12:11:20 PM UTC+12, [email protected] wrote: > > Its immediately on entering the background, but after that it won't show > the error again unless I force quit the app and run it again, i.e., > switching between foreground and background won't trigger the error again. > > stop is making a network call to our analytics system. > > It never runs the background fetch handler at all. > > No location or background audio, the only native interface is to the > analytics SDK and its stopped in the stop method. > > I'll try removing the analytics and any network calls in Background Fetch > and go from there. > > Cheers, > Nick > > On Tuesday, August 23, 2016 at 11:56:52 AM UTC+12, Steve Hannah wrote: >> >> Is that message printed immediately upon entering the background? And is >> it every time it enters the background? >> Do you have anything fancy going on inside your stop() method? e.g. does >> stop() wait for anything to complete, or does it start any longer running >> work? >> Does it ever start to run your background fetch handler at all? >> Do you have any other background stuff going on at all in your app? >> (e.g. background locations, background audio, native interfaces with >> background stuff, etc...) >> Make sure you are calling the onComplete callback inside your background >> handler - and that it isn't running too long. (I suggest just putting in a >> simple System.out.println() and the callback for testing until you get it >> working). >> >> And always remember, for iOS, that you have virtually no control over >> when or if iOS will call your background handler. >> >> Steve >> >> On Mon, Aug 22, 2016 at 4:33 PM, <[email protected]> wrote: >> >>> Using the sample here: >>> https://www.codenameone.com/javadoc/com/codename1/background/BackgroundFetch.html >>> and >>> ensuring that I've added ios.background_modes=fetch to the build hints I >>> get the following error in the console everytime the app goes into the >>> background and nothing is ever output from the background task. Works on >>> Android. >>> >>> >>> Requesting process (process details in here) is suspended and cannot >>> obtain assertions >>> >>> Display isBackgroundFetchSupported() returns true. Application Exits is >>> NOT ticked. >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "CodenameOne Discussions" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> Visit this group at >>> https://groups.google.com/group/codenameone-discussions. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/codenameone-discussions/6e0577ec-4df9-4258-8957-863e746db6eb%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/codenameone-discussions/6e0577ec-4df9-4258-8957-863e746db6eb%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Steve Hannah >> Software Developer >> Codename One >> http://www.codenameone.com >> > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/67bae9bc-f6cf-420e-8037-508f03696d2b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
