Categories
Flex

P2P Apps for Mobile Devices



This post is a follow up to my session at Adobe Flash Platform Summit 2011, Bangalore on the 28th of July. I spoke on Peer to Peer for Mobile Devices with the Flash Platform. Peer to Peer has been around for a long time now, but its not often you see apps making use of this immensely capable technology. My talk covered the possibilities that could come to life with P2P on Mobile, along with some demo’s. Here is the Slide Deck,

As part of my demo at AFPS, I wrote the RealTime Locator, a simple app that shares its location with every peer in a group over the RTMFP protocol. Basically, I do a Lat/Long multicast on receiving the coordinates via GPS. The other interesting aspect is the same app, with ZERO code change is deployed on 3 different platforms, Android, Blackberry Playbook, and the iOS.

Here is a video showing the app running on the three devices, HTC Desire HD, Blackberry Playbook, and an iPod Touch,
http://www.youtube.com/watch?v=uFF4tx82se0

I made use of the freely available non-commercial service, Adobe Cirrus, for initiating P2P connections, and the awesome MapQuest Flex library for displaying and plotting location on the map. The GPS location is represented in Red, and the shared locations in Green.

The FXP has been online for a while now, and here is the link again,
Download Source

Update 7/14/2016: The source is also available at, https://bitbucket.org/immanuelnoel/realtimelocator/overview

Here is what you need to modify to get it working,

Views/MapView.mxml – Replace the value for ‘MAP_KEY’ with your MapQuest API key. Get your key at, http://developer.mapquest.com/
Controller/p2p.as – Replace the value for ‘DEVELOPER_KEY’ with your Cirrus Key. Register for a Cirrus Key here, http://labs.adobe.com/technologies/cirrus/
NOTE : To facilitate P2P connections over the LAN only, replace the value for ‘SERVER_ADDRESS’ with ‘rtmfp://’ and leave the value for ‘DEVELOPER_KEY’ blank (‘ ’).  Optionally also edit the P2P Group Name.

This application only demonstrates one of the capabilities of P2P with Flex. Feel free to get the code and build on it for greater possibilities.

RealTime Locator for Android,Real Time Locator for Android

Download Android Installer (.APK)
The above app uses a different P2P Group than what is seen in the shared FXP file. The two will not work in conjunction.

*The Blackberry and iOS apps are not hosted due to licencing and distribution constraints. Feel free to download the source and deploy on the two devices.

Native Extensions - Flash Builder Webinar
Toast on AIR for Android

By Immanuel Noel

A techie at heart. Works with Adobe at Bangalore, India. Currently do DevOps. Been a part of the ColdFusion Engineering, Flash Runtime Engineering, Flash Builder Engineering teams in the past. Was a Flash Platform Evangelist, evangelizing the Adobe Flex platform. Spoke at numerous ColdFusion / Flash and Flex tech conferences. This blog is a collection of some of my strides with technology.

More on me on the home page

33 replies on “P2P Apps for Mobile Devices”

@Immanuel Noel, Thank you.
I just want to add LBS feature with Flash P2P to my App.Your post is exactly what I need and I will go through it soon.
Thank you again for your amazing tutorial.

Hello Thank you very much, I have attended Adobe Summit 2011 very impressed on this P2P application. I am totally new in Mobile applications. i have build this application but not getting that Red mark is not showing… please help me

@Ramachandra The app will not work ‘On Desktop’ (which is nothing but the simulator) since GPS is not supported. You will have to run it on an actual device. An alternate way though, is to mock location data on the Android Emulator. Here is more on that, http://inoel.in/mockgps

Thank you Noel, I am totally new in this field one que for you. Apple iOS developer certificate is compalsory? i have Apple iPhone 4 with me when i have connected threw iTunes but problem is “Packaging settings have not yet been configured.” when i click Configure then they ask Certificate and Provisioning file. so what can i do? please help

Thank you very very much!!! Sorry i am bothering you…iOS Developer Program
US$99 /year is this correct ammount? Apple Online Store is unavailable, Your country either does not have an Apple Online Store or does not offer Apple Developer Products for online purchase. To complete the purchase of your program, you will need to complete and fax the Purchase Form below. is saying so i will print that PDF file and send it to FAX. so can i go…

hi i want to develop a p2p application on android using cirrus 2 and perhaps action script. can you tell me what are the negative/disadvantages of developing mobile application using this two technologies? in mainly in terms of speed, connectivity speed, searching nodes shared content speed etc.

appreciate your help
cheers
Hossein

@Hossein,

I must say p2p as a technology is well positioned on the Flash platform. If I were to develop a p2p app, the only thing I would need to ensure is the availability of a RTMFP capable server (Unless i’m targeting an audience connected to LAN). As you see in the above app, data flow between the 3 devices is fast ! The delay seen is due to the GeoLocation update interval. And ofcourse, architecting your application the right way (the p2p way) would be one of the foremost considerations. And to answer you, I can assure you speed / connectivity / sharing / searching nodes is something you need not worry about. RTMFP ensures its done the best way !

Hi Immanuel,

Thank you very much for sharing your p2p knowledge. This is very helpful. I am learning how to build mobile apps using flash and Flashbuilder. I would like to run test with your demo to learn. My question to you is, does your demo require the latest Flashbulder version 4.5 to work? Or can I use version 4.0 instead?

Thanks again.
Calvin

c parks,
The demo is centered around using P2P for mobile devices, for which you would need FB 4.5.
However, you can build your own application, and make use of the P2P classes on FB 4.0.

Hi Immanuel,

Thanks for a great App. I am a newbie to mobile app programming and I am finding your code easy to come to terms with. However, I have two problems. 1st in FB 4.6 I am getting a warning that colorDepth should be set to 16bit for optimal performance and 2nd, the map displays well in landscape but does not re-size when the playbook is rotated t portrait. Please can you tell me how to fix these two points as searches on the internet has so-far proved useless!

Many thanks.

bob

Hi Immanuel,

Ok I have fixed the 16bit error it was a setting in the android element of ?????.app.xml. I am still trying to overcomen the portrait/landscape problem any help in this regard would be greatly appreciated.

many thanks in advance,

Bob

Hi I am currently working on an Air for Android App in AS3! This app is running perfectly smooth on an Galaxy S2 with constant 60 fps! My new test device, a Galaxy Nexus with ICS has just arrived and the performance is very bad, unstable 40fps! Now my question is: Is this normal? Is this a problem with my code or is this an known issue of the new operating system?

Immanuel,
Great to hear you’re liking the MapQuest Flex API optimized for mobile use. Let me know any features you’re looking for.

Roman
Product Mgr Dev Services
MapQuest
@MapQuestRoman

Hi Immanuel,

Thanks a lot for the nice post. But let me ask you some very basic questions: I guess, the p2p feature will work well in a typical LAN setup (without any extrenal servers), right? But will the p2p app work on a Local Wifi Network? I’ve developed a chat app, which is working fine if I deploy it to 2 different machines in a Ethernet LAN, but if I deploy this to an Android Mobile Device and a PC – both are connected to the same Wifi network – the p2p feature is not working.
In the Mobile App, I have enabled permission for INTERNET, ACCESS_NETWORK_STATE, ACCESS_WIFI_STATE.
Please help me out.

Thanks,
Geo

is it possible that some phone carriers disable p2p / rtmp conections to avoid ip calls and other undesirable (for them) uses?

@Brandon, Total number of devices supported is limited by the number of devices supported by the router in case of LAN, or by your RTMFP server in case of usage over the web. Essentially, the technology does not pose a restriction.

Seems like the Demo is not working over a WiFi network. Is there any additional set up to be done for connecting over a WiFi network, apart from setting permission ACCESS_WIFI_STATE?

@Vikky, No other special permissions are necessary than what is already indicated. As far as a router is in play, you can have the demo working over LAN. You would need to register for a developer Cirrus key otherwise. But either ways, the demo is supposed to work as expected.

Leave a Reply

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