URI Handlers in AIR for Android: Phone Calls, Email, Text Messages, Maps, Market, and URLs

The code below demonstrates five URI handlers that AIR for Android currently supports:

  • tel
  • sms
  • mailto
  • market
  • http and https

Invoking applications with URIs is pretty straightforward except in the case of maps. Although AIR does not support the Android "geo" URI intent (it’s not fully supported by Google yet, apparently), the code below demonstrates a very good work-around. Rather than explicitly opening the Maps application with a URI, you can just go to maps.google.com, and Android will ask users if they want to open the URL in the browser or in the Maps application. Simple and effective.

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="Home">

      import flash.sensors.Geolocation;

      private var geo:Geolocation;

      private function onCallAdobe():void
        navigateToURL(new URLRequest("tel:4085366000"));

      private function onTextAdobe():void
        navigateToURL(new URLRequest("sms:4085366000"));

      private function onEmailChristian():void
        navigateToURL(new URLRequest("mailto:christian.cantrell@adobe.com?subject=AIR%20Rocks"));

      private function onSearchMarket():void
        navigateToURL(new URLRequest("market://search?q=iReverse"));

      private function onChristiansBlog():void
        navigateToURL(new URLRequest("http://blogs.adobe.com/cantrell"));

      private function onGetCurrentLocation():void
        this.geo = new Geolocation();
        this.geo.addEventListener(GeolocationEvent.UPDATE, onLocationUpdate);

      private function onLocationUpdate(e:GeolocationEvent):void
        this.geo.removeEventListener(GeolocationEvent.UPDATE, onLocationUpdate);
        var long:Number = e.longitude;
        var lat:Number = e.latitude;
        navigateToURL(new URLRequest("http://maps.google.com/?q="+String(lat)+","+String(long)));

  <s:VGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="center" gap="20">
    <s:Button label="Call Adobe" click="onCallAdobe();"/>
    <s:Button label="Text Adobe" click="onTextAdobe();"/>
    <s:Button label="Email Christian" click="onEmailChristian();"/>
    <s:Button label="Search the Market" click="onSearchMarket();"/>
    <s:Button label="Read Christian's Blog" click="onChristiansBlog();"/>
    <s:Button label="Map Your Current Location" click="onGetCurrentLocation();"/>

13 Responses to URI Handlers in AIR for Android: Phone Calls, Email, Text Messages, Maps, Market, and URLs

  1. Lionel says:

    THAT is beautiful !

  2. geeEmGee says:

    Thanks for posting this, very helpful. One question that comes to mind: are any of the same calls you mentioned available on iPhone? I realize Apple has been less accommodating than Google in these areas, trying to figure out how to approach dev for both platforms from a single code base.

  3. Pingback: Scott Janousek » Blog Archive » Invoking applications on Android with URIs in Adobe AIR

  4. Axel says:

    Hey Christian, is it possible to listen to events at the phone level… and intercept them?

    there are some requests out there for text and call blockers / filtering, and there are already some apps out there that do it, but I was just wondering CAN YOU EVEN DO THIS IN AIR? DID THEY ADD HOOKS FOR ANYTHING LIKE THIS?



  5. Christian Cantrell says:

    @Axel: This isn’t currently possible in AIR, but it’s a great feature request. I like the idea. I recommend submitting it here:


  6. Patrick Whittingham says:

    I ran this on the simulator (in FB 4.5) and it just tried to go to the browser (Firefox) for tel/sms). Does this only work on the actual smartphone?

  7. Christian Cantrell says:

    @Patrick: I’ve never tried it with the emulator. In fact, it’s so easy to deploy and test AIR apps on devices that I’ve actually never used the emulator at all. But I guess it doesn’t surprise me that it doesn’t work. I’ve tested on devices, and it works fine.

    • Patrick Whittingham says:


      Can I use the AIR launchpad to simulate a phone? I don’t have one of those Android 2.2 phone.


  8. Brandon says:

    Hey Christian. Enjoyed your session @ MAX!

    In regards to the SMS URI – how does one prepopulate the message/body etc. of the text? E.G. – for email it’s simple:

    navigateToURL( new URLRequest( “mailto:?subject=” + getSubject() + “&body=” + getBody() ) );

    What would be the equivalent for “sms:…” ?



  9. Pingback: AIR for Android and Flex Mobile Resources | Finding Out About

  10. There is a possible hack for SMS. Not perfect but it should work on most phones using Air for Android. I came across it looking for the same solution. The name of the html link says it best