SitePoint’s new “HTML5 Development Center”

HTML5 Logo

I didn’t know if this would be helpful but SitePoint has been putting together an “HTML 5 Development Center”

http://www.sitepoint.com/tag/html5-dev-center/

The only thing that made me “raise an eyebrow” was that the banner on the page says “Developed in part for you by Internet Explorer 9” and evidently Microsoft has been assisting in the project.

[Pause…]

But the good news is this statement on this page:

Browser Neutrality
The HTML5 Dev Center is browser neutral, these are growing technologies and the browsers are always evolving and updating.

In general I really like SitePoint’s reference material, so hopefully they will live up to the browser neutrality policy… ;)

There and Back Again… When iOS Apps Go to The Background

Recently, I was trying to understand what happens when an iOS app goes into the background and then re-emerges later in various ways. It actually wasn’t as straightforward as I thought it would be. This may have already be documented somewhere, but it was a useful educational exercise nonetheless.

The driving reason for exploring the sequence was that I needed to suspend an NSTimer-based process when the app went into the background, and then start it back up when the app returned from suspended animation. Additionally, I needed to refresh a list from a web service when the app emerged, and the issue is that I needed to have it occur just once.

I needed to discover the events that occur and in what order when an app is active in the foreground and the following things happen:

  • User presses Home button
  • User Locks the device

I was also interested in seeing what happens when the reverse scenarios happen:

  • User re-launches app when in background
  • User unlocks the device
  • Initial launch of the app

Turns out the sequence wasn’t quite what I was expecting — but it was very instructive. The following table illustrates my results. The numbers just indicate sequence of events (what happened first and second).

Will Resign Active Did Become Active Did Enter Background Will Enter Foreground
App in FG + Home Button 1 2
App in FG + Lock 1
App in BG + Relaunch 2 1
App in FG + Unlock (after locking) 1
Initial Launch 1

The good thing about creating this table is that it was very helpful in activating and deactivating the NSTimer-based process and also triggering the list refresh when the application submerged and then emerged.

Let me know if anyone is interested in code for this…