Search

 

January 2011
S M T W T F S
« Dec   Feb »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Tags

Archives


« | Main | »

AIR on Android OS Interactions – Text or Call

By Rich Tretola | January 7, 2011
8,951 views

Yesterday, I demoed how to interact with the Android OS for email.

Today, lets look at how to Text or Call. It is just as simple:

Place a Call

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?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="Make a Call">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
   
   
    <fx:Script>
        <![CDATA[
            private function placeCall(event:MouseEvent):void {
                var urlString:String = "tel:";
                urlString += phone.text;
                navigateToURL(new URLRequest(urlString));
            }

        ]]>
    </fx:Script>
   
    <s:Label left="10" top="10" text="# to Call:"/>
    <s:TextInput id="phone" left="135" right="10" top="10"/>
    <s:Button right="10" top="80" height="53" label="Call Now"
              click="placeCall(event)"/>
   
</s:View>



Send a Text

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?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="Send a Text">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
   
   
    <fx:Script>
        <![CDATA[
            private function sendText(event:MouseEvent):void {
                var urlString:String = "sms:";
                urlString += phone.text;
                navigateToURL(new URLRequest(urlString));
            }

        ]]>
    </fx:Script>
   
    <s:Label left="10" top="10" text="# to Text:"/>
    <s:TextInput id="phone" left="135" right="10" top="10"/>
    <s:Button right="10" top="80" height="53" label="Send Now"
              click="sendText(event)"/>
   
</s:View>

Topics: ActionScript 3, Adobe AIR, android, mobile | 3 Comments »

3 Responses to “AIR on Android OS Interactions – Text or Call”

  1. Sandeshaya Sri Lanka Says:
    January 31st, 2011 at 12:43 pm

    I was having run time exception, :(
    can anyone support for this, but this script professional it seems to my fault.

    Reply to this comment

  2. vishnu Says:
    August 24th, 2011 at 1:52 am

    It throwing alert message in firefox:

    Firefox doesn’t know how to open this address, because the protocol (sms) isn’t associated with any program.

    Reply to this comment

    Rich Tretola Reply:

    This code is only for mobile development. It will not work within a browser based Flex desktop application.

    Reply to this comment

Comments