Two days ago, when I was cycling, suddenly I had the answer:
Imagine you have two Windows Phone 7 devices and want to establish a two-way connection between them. For example to play a game of Tic-Tac-Toe. You can do this either with a server on the internet, that connects the clients with each other, or the multicast protocol on WiFi-networks. The same WiFi network may not always be available to both users, but you don’t want to set up a server either (maybe, because you’re only doing this for fun, or you don’t have the resources).
The only way to send messages to a WP7 app via the internet is to use push notifications. But how do you exchange the channel addresses between the devices? One way is to use a QR code:
- Establish a push notification channel on both devices
- Encode the channel URI into a QR code
- Scan the QR code of the other device
- Send a message with your own channel URI to the other device
- Connection established =)
Other methods of exchange can be used as well, for example NFC. You could as well require the user to mail, copy and paste the channel URI, but this is not very convenient.
To my knowledge, push notifications on Android ad iOS work pretty much the same, so you can do this cross-platform as well.
Here are a few screenshots of the sample application (link below), which features a simple chat between the two devices.
Oh and by the way: this works with multiple clients as well!