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?

17 thoughts on “Creating multi-screen apps for Android and desktop using AIR

  1. 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. 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. 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. @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. Okey cool! i am having some trouble with you sourcecode i am on Flex 4.1 maybe that the issue?

  6. @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. Pingback: FLEX{er} » Blog Archive » Two New Apps with Multi-Screen Experince

  8. Pingback: AIR apps for viewing Android pictures on desktops : Mihai CORLAN

  9. Pingback: 50 resources to get up to speed with the Flash Platform : Mihai Corlan

  10. Pingback: 有助于Flash平台开发提速的50个学习资源 – 新闻资讯 – 9RIA.com天地会 – 论坛 | 谱曲

  11. Pingback: Peer 2 Peer and the flash platform - Xavi Gimenez

  12. @Marc

    I’m re-writing this app right now using Flex “Hero” and it will support automatically multiple screen resolutions/DPI.

  13. Cool I have the problem solved btw:). My application new works on android, Iphone & desktop, with any screen size, resolution or DPI.

    Greetz,
    Marc

  14. Pingback: Android Pictures and MP3 Remote Control Reloaded : Mihai Corlan

Leave a Reply

Your email address will not be published. Required fields are marked *