How to Get Alarms in the Background

Unfortunately, with iOS 5, Apple completely changed how “local notifications” are handled. Now, the user has to enable each app for local notifications if they want to receive alerts in the background. I only figured this out recently since it wasn’t documented very well, which is too bad.

You can follow the following steps to get your alarms working in the background:

  1. Go to the Settings app that comes with your iPhone
  2. Navigate to the “Notifications” section
  3. Find “London Bus Buddy” in your list of apps. Click on it to go to a more detailed page.
  4. Turn the “Notification Center” switch ON.
  5. Choose “Alerts” under the “Alert Style” section
  6. Turn the “Badge App Icon” switch ON.
  7. Turn the “Sounds” switch ON.

If you’re checking this on your iPhone, you should know that you can multitask by double-tapping on your home button (a few people aren’t aware of this, so I thought it would be worth pointing out). That way, you can look at these instructions while changing your settings.

Anyways, this should solve any problems you have with the alarm. Hopefully, this helps you out! If not, contact me with your questions.

Version 2.1 Waiting for Review!

Update January 30, 2012 at 22:00: V2.1 is out! Download it now!

With version 2.1, London Bus Buddy is poised to become the most comprehensive bus app on the App Store. And that too for free.

New features include:

  • Countdown (or “Next Bus”)
    • Powered by TFL, you can now see when your next bus is coming by entering a stop. You can check stops from a list of all 19,000 stops or look from a list of stops near you.
  • Online Journey Planning
    • Also powered by TFL, the online journey planner gives more accurate results than the offline one.
    • It lets you plan journeys from/to places of interest, addresses, postcodes, or stops.
    • It also lets you walk between stops, something the old journey planner couldn’t do. A walking map is available for each leg of your trip that involves walking (see the little map button).
  • Alarm fixes
    • Please follow the instructions on how to get the background mode working with alarms! An alert will show up the first time you try to set an alarm. Navigate to settings and follow the instructions closely. There should be a support post up soon about this.
    • Optimized the alarm a bit so it doesn’t try to find excessively accurate coordinates when you’re far away from your destination. The location manager becomes more accurate as you get closer to your stop.

Of course, these features do come with a performance overhead. Namely, startup time has gone up, since I now have to store stop codes for each stop at startup in order to use Countdown. As most users know, their first startup time is usually twice as long as any subsequent one; the reason behind this is that the first startup involves storing files in the documents directory and then reading them out (subsequent startups only need to do the latter).

Here is a list of average startup times based on a few devices I’ve tested on using a stopwatch:

  • iPhone 4S:
    • First startup time ≈ 13 seconds
    • Subsequent startups ≈ 8 seconds
  • iPhone 3GS:
    • First startup time ≈ 30 seconds
    • Subsequent startups ≈ 17 seconds
  • iPhone 3G: I haven’t tested on the 3G, but its hardware is becoming obsolete by this point.

Of course, it’s worth keeping in mind that the app is loading 20,000 stops into memory when it starts up!

As a final note, please inform me if these features behave oddly. Countdown and TFL’s journey planner may go down at times. They may change their formats too, which will completely mess up how I parse their HTML (as I mentioned before, there is no XML API for Countdown yet).