page 1 of 5 next >

Background Apps on the iPhone

The iPhone 2.0 software was recently released, and with it came the ability for users to download native apps (i.e., not web sites) directly to their phones from within the iPhone UI or via iTunes. Developers (anyone who pays Apple 59GBP for the privilege) can then write their own apps and have them available for purchase in the App Store.

One limitation of the Apple-sanctioned SDK is that only one application is allowed to be running at a time. This presents a problem for apps such as IM clients, music players and other programs whose functionality relies on being able to run in the background. Another example (courtesy of James) would be an app that takes advantage of the iPhone 3G's GPS chip to create a log of all the places you visit.

However, there is a neat trick that I discovered: your app will only get terminated if you switch away from it, and hitting the iPhone's power button while your app is in the foreground doesn't count as switching away. The upshot of this is you can create apps which continue to run while the iPhone is in your pocket - perfect for the GPS example.

Achieving this is as simple as implementing two methods in your UIApplication delegate - applicationWillResignActive: and applicationDidBecomeActive:. Here's a simple example to demonstrate the effect.

In your UIApplication delegate header file, add a new ivar: BOOL activeApp. Then, in your implementation, add the following three methods:

- (void)applicationWillResignActive:(UIApplication *)application {
	NSLog(@"resigning active status...");
	activeApp = NO;
	[self performSelector:@selector(sayHello) withObject:nil afterDelay:1.0];
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
	NSLog(@"becoming the active app...");
	activeApp = YES;
}

- (void)sayHello
{
	NSLog(@"Hello!");
	if (!activeApp)
		[self performSelector:@selector(sayHello) withObject:nil afterDelay:1.0];
}

Then run the app on your iPhone, hit the power button, and watch the log fill with pointless but oh-so-cool messages.

Of course, when the phone is put into standby mode by the user the expectation is that barely any juice will be drained from the battery, so it's a good idea for your app to reflect this. Indeed, you can make a big difference by halting your updating of the UI; the user isn't going to see it when the screen is turned off.

This isn't a perfect method, and won't be helpful in situations where the user wants to do other things with their phone while your app continues to run. However it might come in handy for certain scenarios.

date: Mon Jul 21 06:03:56 2008 | permalink | tags: howto iphone code

Five of my Favourite Video Games

In response to James's meme, I thought I'd join in the fun and share a few of my favourite games. So, in no particular order, here are five games everybody should experience at least once in their lives.

Lander

Lander Screenshot

Lander is, I believe, the first game I ever played. Calling it a game is a bit of a misnomer, perhaps, as it was really just a tech demo that was put together to show off the graphical prowess of the Acorn Archimedes. However, trying to explain that to my 8-year old self would have been a hard task, given the sheer amount of joy I got out of flying this little space ship around a rough-and-ready 3D terrain and blowing up trees and buildings. The game was notoriously difficult to control - you tilted the craft with the mouse and engaged the underbelly thruster with the middle mouse button, but the slightest twitch in the wrong direction or misjudged boost would send you crashing to the ground - but once mastery was achieved, you would be the envy of your friends who looked on in awe (silently hoping that you'd crash soon so they could have a turn).

Grand Theft Auto IV

GTA IV Screenshot

Moving forward a decade and a bit, this is perhaps an obvious choice but the GTA series are all fantastically well-executed, IV especially so. I've always been a PC gamer, but I couldn't help but join the console crowd when this was released for the PS3 and Xbox 360 without a release date for the PC version anywhere on the horizon. The tipping point came when I realised I'd have to spend about the same to upgrade my PC to be able to play this game as it cost in a 360 bundle deal from Play, so I took the plunge.

There's not a lot I can say about this game that hasn't already been put far more eloquently by others, and a Metacritic score of 98 (at the time of writing) speaks for itself.

Crystal Caves/Commander Keen

Crystal Caves Screenshot Commander Keen Screenshot

Putting two games together is perhaps cheating a little, but they're so tightly intertwined in my memory that separating them wouldn't be right. Both old platformers, both brilliant fun and both a great way to introduce my 8-year old self to 'proper' gaming. Many an hour was spent staring at the screen whilst my characters ran around collecting crystals, power-ups, jumping on bad guys and completely failing to understand the more intricate plot twists and subtle humour intended for the game's more grown-up audience.

In some ways, these games were more than mere entertainment, they were my introduction to computers and how they worked. cd, diring my way around the floppy disks' directory structure and tweaking settings in the games' configuration files piqued my interest in how it all worked behind the scenes, and it was only a couple of years later that I was writing my own programs in GW-BASIC.

Half-Life 2

Half-Life 2 Screenshot

No 'best games evar!' list would be complete without a nod to the epic created by Valve Software and its subsequent episodes. The original Half-Life was a phenomenal game so of course all eyes were on Valve to come up with something that surpassed that game's greatness. Of course, those geniuses pulled it off with aplomb. Never a dull moment in the game, and 3.5 years later the game looks fantastic as ever.

The deathmatch component, while taking a little longer to appear than people had hoped, is an absolute blast, and cutting people down by launching office furniture or broken toilet bowls at them never fails to bring a huge grin to my face.

Starcraft

Starcraft Screenshot

Warcraft II was a fantastic game, the multiplayer especially, but Starcraft improved upon it in just about every way possible. I'll admit that I never really got into the single player mode, but that was purely because I spent so many hours playing multiplayer with friends. It came along at just the right time - all my friends had PCs capable of playing the game, and we were at the age when there was nothing more exciting than congregating at one house and spending all weekend playing the game across a hastily-cobbled together LAN. Here's hoping Starcraft II is able to live up to the reputation of its predecessor (all signs point to 'yes', it seems).

Next, I tag Steve to share his list with us all.

date: Tue May 27 17:17:24 2008 | permalink | tags: meme games

iPhonalicious

Whenever I went out anywhere, I always used to put my iPod in my left pocket and my phone in my right.

Since I got an iPhone, I'm never quite sure which pocket to put it in.

date: Tue Aug 28 18:03:03 2007 | permalink | tags: iphone

A Post

So much has happened since I last blogged - here are some of the highlights:

Chris visited for a week or so, which was lots of fun. We played what we thought was free pool then got charged 31.50EUR for the privilege, enjoyed ++cheap beer, saw Death Proof, climbed huge rock formations while laughing hysterically, and sunk into a waist-deep container of wet cement (note - this only happened to one of us, and it wasn't me).

A third flatmate moved in - one Philip Van Hoof, who's in Helsinki working on Tinymail. He's here for another couple of weeks, and after he's gone a second third flatmate is joining us for the next five months - a Californian by the name of John Solis.

I got my digital camera back from Chris, so I'm more likely to get some photos uploaded at some point. In the meantime, here are a few snaps:

A Series of Tubes Shruti the Tram Orange Gerberas Agoraphobia, anyone? Tag Ear

Work itself is going really well - I've been learning a lot, enjoying the work, and am starting to really get my teeth into the project now. It's a lot of fun!

date: Wed Jun 13 20:36:51 2007 | permalink | tags: photography finland

I'm an Author!

I'm going to Singapore in September! The paper I co-authored was accepted to MobileHCI 2007!

Have been super busy since last I last blogged, will post a proper update soon.

date: Tue May 29 12:33:24 2007 | permalink | tags: uni research hci

A Quote

"When I want to relax, I pick up a book - my favourite mobile device."

Matt Jones

date: Tue May 22 15:34:33 2007 | permalink | tags: finland hci

Web 2.0: The Poster

Web 2.0: The Poster
I noticed this poster on the wall at work yesterday. It's a fun game to try and recognise as many logos as possible. TextMate FTW!

date: Tue May 22 05:48:17 2007 | permalink | tags: finland

CityWall, Ubuntu and Vegetarian Cafes

Wandering around one of the squares in Helsinki this evening, I stumbled across an interesting installation in the side of a building, called CityWall. It's a large touch screen interface that displays photos taken around the city by inhabitants and visitors. You can interact with the display by 'grabbing' the photos with your hands and manipulating them as if they were real photos on a flat surface.


Shruti playing with the CityWall installation.

The interaction is quite intuitive doesn't present any real difficulty when using it. On occasion it would get a bit confused and stop responding for a second or two, or zoom a photo to fill the entire screen with nothing more than an accidental flick of the wrist, but on the whole it's very easy. The display is kind of tucked away under an awning, and I only noticed it because of the light being emitted from the screen. When we were playing with it, I noticed that lots of other people gathered behind us to watch, and a few stepped forward to have a go too. What's nice is that more than one person can use the system at a time, and the screen is wide enough to accommodate three people stood side-by-side.

From an HCI point of view, the project spans a lot of ground. The interface, while not entirely novel (see the Multi-Touch interface as pimped by Jeff Han for the most recognisable example), isn't something the general public are likely to have come across (yet, at least. The pending release of the iPhone will bring two-fingered touch screens to the masses). The user-generated content is another aspect, although it is curated and moderated by the project organisers as opposed to displaying unfiltered content directly from users. Pictures (and video, apparently) are sent to the screen as email or MMS messages, and certain items are selected to be displayed based on their relevance to current events in the city. I wonder how the system would be different if it allowed instant and unfiltered display of user content? That users can attach captions to photos draws some parallels with digital story projects, such as Story Bank. Currently there appears to be no way to retrieve content from CityWall to take away with you, it has to be experienced in-situ.

On a different note, we discovered a rather cool cafe just around the corner (everything seems to be 'just around the corner' in this town, I love it!). It's a vegetarian place that serves fair trade coffee (the first time I've seen that logo so far), has free WiFi access, a shelf full of books, board games and the like, and, best of all, a stand of Ubuntu Linux CDs! The CDs appear to be placed there by either Linux-tuki or Ubuntu Suomi, which makes sense as this place is the home town of the project we all know and love. There were only a couple of CDs left, so I guess there are some happy Ubuntu converts out there. On the other hand, they deperately need updating, as the CDs were version 5.10 (the "Breezy Badger" version, which was released in October 2005). Better still, they had a laptop sitting on a table which was running Ubuntu and free for all and sundry to use to check their email, surf the web, etc. Although the cafe was nice, I got the impression that it was very 'local', as I didn't see a single word that wasn't Finnish. We felt very welcome, however (although we got there 15 minutes before closing time, so didn't want to hang around too long).

Random observation: Since arriving, my mobile phone signal hasn't (that I've noticed) dropped below 100%. Apparently landlines are few and far between in Helsinki, so it makes sense that mobile coverage is above what Swansea has led me to accept as 'normal'.

date: Mon May 21 20:57:39 2007 | permalink | tags: linux phd iphone finland hci

The First Day

"Assistant Research Engineer". That's what it says on the contract I signed today, and that is what I'm going to be until 20th November 2007, when said contract expires.

The day got off to a wobbly start - I'd been told last night by the hotel that there were no free rooms for tonight, so I'd packed my cases in readiness to check out. I was informed by the receptionist that two spaces had in fact become available for Shruti and I, so we were able to stay in our rooms for one more night. Shruti was told something completely different by a different receptionist, however, and ended up lugging all of her stuff into my room as she had to check out. When she tried to do so, they explained that there had been some crossed wires, and in fact she could stay for one more night in her room, so we lugged all of her cases back up to her room.

Taking the tram to the Nokia Research Center (NRC) was fun - it's only about 10 minutes away. Helsinki seems small enough that getting from one place to anywhere else in the city probably won't take more than 20 minutes by public transport, and it's not hugely expensive either.

When we arrived at NRC, we were shown upstairs to the area we'll be working in, which is really nice. We were given a grand tour of the building, which is really impressive. It's only about 8 years old, and it shows - everything is still shiny and new. There's a gym, a library stuffed with geeky books and magazines, a canteen which serves up delicious and cheap food, saunas, etc etc. One thing that impressed me at lunch time was the Finnish system of cleaning up your tray after you finish lunch. Instead of simply shoving it on a rack and expecting somebody else to deal with it, you take your tray to an area where you seperate out the items yourself. Leftover food goes in one bin, paper towels in another, and all other litter into a third. Cutlery is thrown into a waiting crate, crockery is placed in racks, and finally the empty plastic tray is added to a pile. I guess this is nothing extraordinary to the people accustomed to it, but it struck me as a really good idea.

The day's work consisted of not very much at all - most of my team were away today, so the real work begins tomorrow, when everyone is back. I had to get my laptop setup by the PC tech guy, and it was seriously impressive to watch him fix three peoples' laptops while giving phone support to a fourth. He seemed to take it all in stride though, and didn't appear in the least bit stressed by the situation. Good stuff!

I visited the apartment today, and it looks every bit as good as the photos I'd seen previously. We negotiated a slightly more sane price with the estate agent (Kiinteistomaailma - I've gone from a country whose language uses too few vowels to a country whose language more than compensates...) - 600EUR/month which includes gas, water and TV license. We're moving in tomorrow! Now we've just got to argue over decide who gets what room. :)

date: Mon May 21 17:28:24 2007 | permalink | tags: finland

Somewhere New

I'm in Finland! Helsinki, more precisely, and the Scandic Continental Hotel if you wish to be yet more precise. The reason for my visit is that I am going to be working as an intern at Nokia until mid-November, whereupon I shall return to Swansea and begin^Wcarry on working towards my PhD.

Helsinki itself is very nice, and although the city is quite small, I've not explored it completely yet. I'm staying a short walk from the downtown area, which is filled with shops, restaurants and bars. Last night Shruti (another intern) and I visited a jazz cafe and watched some awesome musicians play while we ate our dinner. I was pleasantly surprised by the food - everyone told me to expect terrible things to be brought forth from Finnish kitchens, but it was delicious. Of course, I'm not claiming a beefburger to be the quintessential Finnish dish, but it was gooood.

I spent today wandering around the city, checking out parks, shopping malls and the like, and it's a fantastic place. We've found an apartment about 10 minutes by cycle from Nokia in one of the nicer parts of the city - I'm going to take a look at it tomorrow. All signs point to it being a great place to live - big rooms, situated 2 minutes from a fantastic park and the waterfront, 2 minutes in the other direction to shops, and, most importantly, there is a camera shop just around the corner! I've only taken a few photos so far, but I'll post them up here when they've been developed.

Of course, the apartment might yet fall through, as we've not yet signed the contract, and it's towards the higher end of the range I'd like to be paying for rent (650EUR/month!).

I start work tomorrow, and I imagine the next few days will be filled with mostly run of the mill paperwork and related formalities. Coincidentally, Matt is giving a talk at NRC on Tuesday, which should provide some (comic?) relief.

That's all for now!

date: Sun May 20 16:15:59 2007 | permalink | tags: finland
page 1 of 5 next >