← Back to team overview

ubuntu-phone team mailing list archive

Re: Background services: a problem that we need to face

 

On Wed, 2014-06-25 at 13:40 -0700, Alex Chiang wrote:
> >> > https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW20
> >> >
> >> > Apps can have long-running background tasks for certain things, on iOS.
> >>
> >> Apps can only run in the background for a limited time, and they can use certain
> >> APIs to get woken up regularly, but they can't run in the background save for a
> >> few exceptions. This is why IRC apps on iOS disconnect after a few minutes, or
> >> are designed for jailbroken devices.
> >
> > No, apps can run in the background indefinitely, per the documentation
> > link I provided above, in order to handle a situation in the specific
> > list of situations described in that documentation.
> 
> No -- iOS apps do not *actually* run in the background indefinitely.
> This is trivially observable on an iPhone.

Running indefinitely != "in the low level running state for an
indefinite period." Running indefinitely means it has an active PID, and
it might be in sleeping, stopped, or running states. For example, open
top and you'll see that most processes, including the daemons in the
background, are in the sleep (S) state, even on a massive i7 workstation
where battery life isn't an issue. Running doesn't mean it's consuming
energy. It just means it is in memory.

> - start Strava (GPS app to track your running/cycling data)
> - launch the camera in HDR mode, take a photo of the awesome scenery
> - load Google Maps app to figure out your next turn
> 
> Go back into Strava and observe that it has been killed by the OS.
> Strava will ask you if you wish to resume recording from last known
> point.

Do you have the source code to Strava? Is it open source?

Do you want to buy me an iPhone 4S and a Macbook so I can actually build
an iOS app and test it against what the documentation says?

My only reference is the documentation. I can't tell you how a specific
proprietary app that was probably contracted out to a random "build a
random iOS app" development house works, but I can tell you what the
documentation says to me.

>From your statement about how Strava behaves, it sounds to me like it is
not registering for background processing to the location service,
according to what the documentation about long-running background
processing and the location service on iOS, says.

If you want to send me an iPhone 4S and a Macbook though, I'm happy to
investigate further by writing an app for iOS and testing it against the
documentation. But I have no way to write such an app without a Mac, or
test it without an iPhone, or at least an iPod (assuming the iPod has
the same level of GPS and bluetooth capabilities of the iPhone).

I'm pretty certain the Ubuntu One music streaming app for iOS continued
streaming audio as a background process though, and did not need the
screen on or to be the foreground app the user was fiddling with, for
streaming to work. And not because it was a single URl that was
constantly sending data that some system process was listening to.




References