Creating multi-screen apps for Android and desktop using AIR

Today, I finished a project I’ve been working since last week: a desktop MP3 Music Player that can be controlled by any number of Android phones. I built these apps using Adobe AIR and the Flex framework. Below you can watch a video with these apps in action, running on Motorola Droid, Nexus One, and my laptop (you can watch here the video in a higher resolution).

The communication between the remote controls (AIR apps running on Android phones) and  desktop player is done using the peer to peer features of AIR 2 and Flash Player 10.1. Basically if all the parties are connected to the same subnet and if the network allows broadcasting, then you can create a group and send messages to all the members without the need of Stratus or some other service/server.

Actually, while working on this project I created a small class that enables you to quickly create clients who connect to a local network. Of course, this is only one way of connecting two or more clients. You can use sockets if you want, or one-to-one communication (peer2peer). But I think in both these cases you have to work more, because you have to manually manage all the parties involved. If you want to find out more about peer2peer features of the Flash Platform take a look at this MAX session and read my fellow evangelist Tom Krcha’s blog.

The Android app was more fun to build because I used the touch input mode along with click input. I enjoyed a lot tweaking James Ward’s code for scrolling a Flex List. Believe it or not, again I used Illustrator and Flash Catalyst a lot to create the skins or parts of them.

Until I have the time to put together an article explaining  how these apps were created, please enjoy the video and play with the apps: desktop file and APK file. And from here you can download an archive with the source code. If you need the Adobe AIR runtime or AIR SDK for Android, please sign in for the pre-release group here.

What do you think?

Comments

13 Responses to “Creating multi-screen apps for Android and desktop using AIR”

  1. 1. Dan on July 4th, 2010 10:08 am

    This is great! Thanks for sharing this. I have not fooled around with the peer to peer stuff, so this will give me something to look at. I did notice the scrolling of the list is a little touchy. Sometimes while scrolling the playlist, it selects a song when I did not intentionally want to. I did notice this on James Ward code also. I tried to improve the scrolling but didn’t come up with any thing better. I wonder if I try the touch scrolling code on a different touch device other than the nexus one to see if it behaves differently. This gives me a lot of ideas for my home automation project.

  2. 2. Mihai Corlan on July 4th, 2010 7:00 pm

    Indeed, the code for the scrolling list could be better. This is what I had the time to put together for this pet project :). Things will be much easier in the next version of Flex (Hero).

  3. 3. Dennis Green-lieber on July 5th, 2010 9:09 am

    Hey mihai,
    Great stuff! can we not achieve the same with the serversocket API so there is no need for a online peer2peer service so the app will work on a local network.

    my problem is the discovery of services – have not had time to look at it but are considering an nativeprocess solution.
    any ideas?

  4. 4. Mihai Corlan on July 5th, 2010 9:49 am

    @Dennis

    If you take a look at the source code, you’ll find a library where is all the logic for connection. I added logic to return the IPs. So you could use peer 2 peer for discovery service and then sockets for communication (as long as you work in the same subnet, like my demo, you don’t need Stratus or a server).

  5. 5. Dennis Green-lieber on July 5th, 2010 10:31 am

    Okey cool! i am having some trouble with you sourcecode i am on Flex 4.1 maybe that the issue?

  6. 6. Mihai Corlan on July 5th, 2010 10:44 am

    @Dennis

    Both projects use Flex 4.1. The desktop player is compiled with AIR 2.0.2 and the Remote Control with AIR 2.5.

  7. 7. Dennis Green-lieber on July 5th, 2010 10:57 am

    okey, i will try to compile it :) thanks

  8. 8. FLEX{er} » Blog Archive » Two New Apps with Multi-Screen Experince on July 6th, 2010 12:17 pm

    [...] Desktop MP3 Music Player by Mihai Corlan [...]

  9. 9. AIR apps for viewing Android pictures on desktops : Mihai CORLAN on July 9th, 2010 1:21 am

    [...] to desktop apps I used Peer-to-Peer direct routing (the same approach used in my previous app). As I already explained, if your local subnet (for example your home WI-FI) accepts broadcasting [...]

  10. 10. 50 resources to get up to speed with the Flash Platform : Mihai Corlan on July 29th, 2010 4:58 pm

    [...] apps that connects to desktop apps using Peer 2 Peer: here and [...]

  11. 11. 有助于Flash平台开发提速的50个学习资源 – 新闻资讯 – 9RIA.com天地会 – 论坛 | 谱曲 on August 8th, 2010 4:50 pm

    [...] Service和AIR的Android的视频图表•        使用P2P连接桌面apps的Android apps:这儿和这儿•        如何安装AIR for Android [...]

  12. 12. Peer 2 Peer and the flash platform - Xavi Gimenez on August 17th, 2010 1:03 am

    [...] Mihai Corlan have shown another nice example of what can be done using the peer to peer features. This time using several Android mobile phones [...]

  13. 13. Victor on August 26th, 2010 9:34 pm

    Nicely done. Thanks for sharing the code!

Leave a Reply




Switch to our mobile site