

The right way to do iPhone 4.0 OS Backgrounding . . .  - aresant
http://www.mobypicture.com/user/shuether/view/6955637

======
ant5
It seems like disrupting the user is the exact opposite of what Apple was
trying to achieve with background support.

The right way to do backgrounding:

\- Consume the least amount of CPU possible. Optimize, optimize, optimize! If
you're implementing a network app and there are no events coming in over the
network, your process should be doing _nothing_ , blocked in the kernel.

\- Drop as much RAM as possible before you go under. There's only so much RAM
on the device. Apple's frameworks try to drop as much as they can, but if
you're holding onto a cache or anything that can reasonably be reconstructed,
now is the time to drop it. This increases the likelihood of you surviving in
the background after your process has been put to sleep, too.

\- Work seamlessly. If iOS terminates your app due to low resources, re-start
exactly where you were before. Don't show an annoying dialog like this one
when you switch to the background. Don't show a ridiculous "splash" screen
that wastes user's time. Just work.

If done right, you can maintain a very small footprint, and then you don't
need to annoy the user by asking every time: "is this OK?".

~~~
thought_alarm
That was my initial reaction, too. But for an app like Trapster it might not
be a bad idea. (I haven't used it, but I guess it's an app for tracking speed
traps)

Most apps do nothing in the background. Others, like music or GPS apps, it
should be obvious to the user that these apps are doing stuff in the
background. For an app like Trapster, however, it would be easy for the user
to forget or not understand that it's working in the background. I, as a user,
might appreciate this kind of warning from an app that I normally would not
want running in the background.

By default, I would have it not do anything in the background (which is how it
obviously works on OS 3). I would have a setting that enables it to run in the
background, as well as a setting that enables the warning. It sounds like
that's exactly what they're doing, although I don't know what their default
behavior is.

~~~
fortybillion
If the app is using the background GPS process, there's already an indicator
in the title bar (the little purple arrow) showing that the GPS is being used.

------
BigZaphod
This is very much the _wrong_ thing to do. When I push the home button, I
expect the app to go away so I can get on with the next thing. I certainly
don't expect it to desperately attempt to preempt my attention one last time.

------
Terretta
Ok, I was just trying to quickly switch to another app, but thanks for telling
me.

Now that you've told me, if I don't want to consume the battery, what do I
click?

Or, consuming the battery is fine, and I want to keep Trapster running. What
do I click?

// Seems this is a better example of the _wrong_ way to do backgrounding.

------
jonknee
I'd likely delete an app that tried to pull that, the whole point of
background processing is not to bug the user.

------
powrtoch
Re: most of these comments:

I'd be okay with it as long as it only popped this up the first time it went
to background mode. Arguably it'd even be a good feature since a lot of users
might not know about the tradeoff involved in backgrounding.

~~~
bonaldi
There's no problem with asking the user about this; the point is not to do
when the app is going into background.

If you're concerned that most of your users won't want this, then turn it off
by default and have an option to turn it on.

The model to follow here is the iTunes Remote app. It allows you to remain
connected in the background, but you have to activate it from settings, where
there's a little explanation of the trade-off.

Doing it the way this app does is plain nasty.

------
trapster
Trapster allows users to choose whether to run in the background or not. You
can also choose to receive push notification if background running isn't your
style but you still want to be updated of live enforcement points or road
hazards. We want our user to be happy and we listen to their ideas. I hope
you'll give the app a try, over 6.9 million users world-wide have :) ~Stefanie

------
pkulak
Why do you need to tell the user that you're going to keep working in the
background for 10 lousy minutes? Because, that's all you get.

------
pclark
I'd rather Apple just offer a "notification" API in iOS4.1 that lets apps push
their state to the user.

------
drivebyacct2
For varying definitions of "right". On my phone, Trapster runs, displays an
icon in the notification bar and you know "just works" (where have I heard
this before) with no user interference.

Some mobile OSes have an application architecture and structure that were
built to be multitasked, others are only now adding it and it shows in some
apps, like this. It's all about the mindset that the platform takes to
multitasking. That is, if you want to call the various implementations
"multitasking".

