Background service in iOS?

266 views
Skip to first unread message

Brent Picasso

unread,
Nov 13, 2014, 3:08:35 PM11/13/14
to kivy-...@googlegroups.com
Hello,

I've come across this rather excellent solution to work around multi-processing limitations of Python on Android:

Question: what is the state of this capability on iOS? What alternative options do we have?

Essentially, I need a background task to perform messaging / networking operations behind the scenes, leveraging other processing cores of the device in order to keep the UI responsive.

On Android, I'm talking to a bluetooth device via Pyjnius. With the limitation of Python's GIL, servicing the BT port in the same app results in dropped data while the UI is busy rendering. Clearly Android's BT stack has minimal buffering.

On iOS, we'll be talking over a network socket - we may enjoy some built-in buffering from the network stack, mitigating any brief interruptions due to UI rendering.

Any help/advice/alternative approaches would be appreciated!

-Brent

Bruce Cropley

unread,
Nov 13, 2014, 10:32:31 PM11/13/14
to kivy-...@googlegroups.com
Hi Brent

iOS doesn't currently support multiprocessing in apps. They have their own special technology "Multitasking" that can be used for some similar things: http://support.apple.com/en-au/HT4211
I haven't used it.
What I have done is use multithreading on iOS, with cythonised extension modules doing the hard work. You could try using the "nogil" cython keyword. I haven't yet.
My strategic game app is MIT open sourced, and the marginally relevant code is in pentai/ai/ai_player.py:
https://github.com/cropleyb/pentai

HTH,
Bruce

Brent Picasso

unread,
Nov 14, 2014, 12:17:58 AM11/14/14
to kivy-...@googlegroups.com
Thanks Bruce , great info. When we get there I'll report back. 

--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/axEVSK8AAJA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Brent Picasso
Technology for Race and Street

ZenCODE

unread,
Oct 21, 2015, 9:55:59 AM10/21/15
to Kivy users support
Hi

Bumping this up. Any news? We are looking at downloading content and updates in the background whilst the user interacts with the GUI (Android no problem. iOS?)

Tx

Brent Picasso

unread,
Oct 21, 2015, 10:40:12 AM10/21/15
to kivy-...@googlegroups.com

Hi, thanks for bumping this. Curious, what's your approach for doing this background work on android?

Brent Picasso
Autosport Labs
Technology for Race and Street

--

ZenCODE

unread,
Oct 21, 2015, 10:44:28 AM10/21/15
to Kivy users support

Brent Picasso

unread,
Oct 21, 2015, 10:54:16 AM10/21/15
to kivy-...@googlegroups.com
Got it. We originally tried that with Android bluetooth comms, passing data to the main app via OSC, but what worked better in the end was some native java, including a java background thread. This worked well since we had to touch the Bluetooth stack anyway, and didn't want to bother with the NDK.

Are you also using OSC to pass messages? I was thinking of trying zeroMQ  before we switched to the Java thread.

Looking at it again for some data processing, cython seems very appealing now for some CPU bound work we'll be doing. 

-Brent

On Wed, Oct 21, 2015 at 7:44 AM, ZenCODE <zenkey....@gmail.com> wrote:

--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/axEVSK8AAJA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

ZenCODE

unread,
Oct 21, 2015, 12:46:52 PM10/21/15
to Kivy users support
To be honest, we haven't implemented anything using it. We just did a proof-of-concept test which worked. It's enough for us right now to know we can, I was trying to establish the same for iOS. Have you got anything working or planned for iOS?

Brent Picasso

unread,
Oct 21, 2015, 5:24:29 PM10/21/15
to kivy-...@googlegroups.com
iOS is on the short list, indeed, no concrete work on it, yet.  Aside from bluetooth, we're not doing anything weird, so it should be a straightforward port; from what I understand we need to make sure we have the appropriate resolution splash screens in place to make all of the hardware variants happy.

-Brent

On Wed, Oct 21, 2015 at 9:46 AM, ZenCODE <zenkey....@gmail.com> wrote:
To be honest, we haven't implemented anything using it. We just did a proof-of-concept test which worked. It's enough for us right now to know we can, I was trying to establish the same for iOS. Have you got anything working or planned for iOS?

--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/axEVSK8AAJA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pierre....@gmail.com

unread,
Sep 26, 2016, 11:12:27 AM9/26/16
to Kivy users support
Hi,

I want to have notifications being made even if the application is killed, like it is done with Facebook or What'sApp... etc

Like Brent and ZenCODE I looked at "http://kivy.org/planet/2014/01/building-a-background-application-on-android-with-kivy/". I haven't tested it yet but I guess it does the job. In this way I also want to do the same for iOS. Any solution came around?

If you have any suggestions for my problem I'll be happy to have them (I am new to Kivy, excuse me if the solution is obvious),
Pierre

ZenCODE

unread,
Sep 27, 2016, 1:51:35 AM9/27/16
to Kivy users support

We solved our issue not by building a service but by using the BackgroundTranserService (example in kivy-ios). You essentially just ask for a file and then get a notification (via a delegate) when it's done.


So perhaps it's not a service as you need. There might be some notification equivalent for 'message_arrived'? I would investigate that as the easiest solution?


Peace out

Reply all
Reply to author
Forward
0 new messages