How does iPhone toasting/bumping apps work? I've just seen the ad for IKEA Skål!. If you haven't seen it, you can see the video linked. Basically, you can choose a drink and make a toast-like gesture (using the iPhone) with another person having the app. This results in both phones automatically exchanging names and photos, and optionally both of them will share the picture of their toast on Facebook. The ad is really nice, but I am curious about how it works. 

[Edit]: As a commenter pointed out, there is also another application Bump, which use the same technique to perform similar (and even more) functionalities. The FAQ stated that this application was designed with personal and data security in mind, and uses various sensors and algorithms to "feel" the bump and the server will find matching bumps according to the sensor reading and algorithms.

How exactly does the iPhone know that I am toasting/bumping with another person? I mean I don't think GPS can track the phones that accurately. And how does it transfer the contacts and photos? And how can it correctly determine who is toasting with whom if there are multiple users in the same room? How is the security and confidentiality protected?
I don't have the facts to back this up, but my guess is that when the app is open it's searching for other open apps on bluetooth or local wi-fi. Then perhaps the physical "clink" is registered by the accelerometer and its timestamp matched with your friend's app.

I don't think this is meant to be that serious of a thing in the first place, so there's likely not that much security (and it would totally kill the mood if you had to exchange passkeys or something in order to make a stupid Facebook post). Of course, the fact that the iPhone is a closed platform and the App Store is regulated is some measure of security--no one would be able to distribute an app that harvested contact information from the Toast app. The Toast app probably only shares when it's running and active in the front.