Background fetch

59 views
Skip to first unread message

mm....@gmail.com

unread,
Apr 24, 2016, 7:26:03 AM4/24/16
to CodenameOne Discussions
I was about to implement background fetch using native interface, but I stumbled over this gitbook by shannah, which mentions a CN1 background fetch API.

However I cannot find any other reference to it. Is it still in the works? If so what is the timeline ?

Shai Almog

unread,
Apr 25, 2016, 12:00:40 AM4/25/16
to CodenameOne Discussions, mm....@gmail.com
I think Steve can probably answer this best.

shannah

unread,
Apr 25, 2016, 12:15:19 PM4/25/16
to CodenameOne Discussions, mm....@gmail.com
I Didn't realize that this gitbook was public.  I created it as a means of sharing docs with the CN1 team when we were originally looking into background APIs.  The APIs discussed in this book were mostly scrapped (the entire commit that it documented was reverted).  We currently provide an API for IOS' background fetch.  If you want to perform background fetches you'll need to either use native interfaces, or just use ConnectionRequest/NetworkManager - which will work if your app is running in the background.  

Steve

Steve Hannah

unread,
Apr 25, 2016, 12:17:04 PM4/25/16
to codenameone...@googlegroups.com, mm....@gmail.com
 We currently provide an API for IOS' background fetch.  

Oops.  This should read:

We currently DON'T provide an API for IOS' background fetch 

mm....@gmail.com

unread,
Apr 26, 2016, 2:24:13 AM4/26/16
to CodenameOne Discussions, mm....@gmail.com
Well in order to have my app running in the background I would then need to write native.

The API you presented looked rather need. Why did you scrap it ?

Shai Almog

unread,
Apr 26, 2016, 11:53:42 PM4/26/16
to CodenameOne Discussions, mm....@gmail.com
It was in the planning stages and never matured to an actual implementation.
I think we should add that, feel free to submit an RFE to the issue tracker as I think we need something like this.

Steve Hannah

unread,
Apr 27, 2016, 11:49:38 AM4/27/16
to codenameone...@googlegroups.com, mm....@gmail.com
For reference, this branch is where the implementation was.

You can see it in the last two commits.  

We decided to abandon it because the limit of 30 seconds of execution inside a background fetch handler would probably cause confusion amongst developers - and the API was a little too platform specific (there might not be good equivalents on other platforms).

The implementation I had just fell back to a regular timer event to periodically fetch data from a service on platforms that didn't support background fetch.

Steve

On Tue, Apr 26, 2016 at 8:53 PM, Shai Almog <shai....@gmail.com> wrote:
It was in the planning stages and never matured to an actual implementation.
I think we should add that, feel free to submit an RFE to the issue tracker as I think we need something like this.

--
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 codenameone-discu...@googlegroups.com.
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/593b0a96-1d9b-43dd-9776-28850941dcaf%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

mm....@gmail.com

unread,
May 9, 2016, 12:05:15 PM5/9/16
to CodenameOne Discussions, mm....@gmail.com
Sorry for the late reply. Crazy days...

I don't the reason that you have to enforce the 30 seconds. That is up to the developer.
So on Android the developer could go crazy while on iOS they would have to set some timeouts.

What you then provide is a generic framework for using the bg fetch capabilities on either platform.

How does that sound ?

Even if it is platform specific it does seem a bit crazy that when you have the code you and still explicitly forces the devs to go native.
Then they're forced to make something for each platform.



On Wednesday, April 27, 2016 at 5:49:38 PM UTC+2, Steve Hannah wrote:
For reference, this branch is where the implementation was.

You can see it in the last two commits.  

We decided to abandon it because the limit of 30 seconds of execution inside a background fetch handler would probably cause confusion amongst developers - and the API was a little too platform specific (there might not be good equivalents on other platforms).

The implementation I had just fell back to a regular timer event to periodically fetch data from a service on platforms that didn't support background fetch.

Steve
On Tue, Apr 26, 2016 at 8:53 PM, Shai Almog <shai....@gmail.com> wrote:
It was in the planning stages and never matured to an actual implementation.
I think we should add that, feel free to submit an RFE to the issue tracker as I think we need something like this.

--
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 codenameone-discussions+unsub...@googlegroups.com.

Shai Almog

unread,
May 10, 2016, 12:23:19 AM5/10/16
to CodenameOne Discussions, mm....@gmail.com
Some things are harder to abstract across platforms, background behavior is one of the things that is just too different between the various platforms.
We try to keep the philosophy of making stuff super easy and portable but make the hard stuff possible. Background behavior is mostly hard stuff...
Reply all
Reply to author
Forward
0 new messages