Create Text Message

The URLRequest class can be used to open the Messaging application to send text messages. By prepending the request with sms:, you will tell Android to launch the Messaging application when the navigateToURL method is called. Figure 6-3 shows
the sample application running and Figure 6-4 shows the Messaging application with the phone number pre-populated. Unfortunately, at this time it is not possible to send a message along with the phone number when using the Messaging application:

<?xml version=”1.0″ encoding=”utf-8″?>
<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”>
<fx:Script>
<![CDATA[
protectedfunction sendIt_clickHandler(event:MouseEvent):void
{
var s:String = “”;
s += “sms:”;
s+= sendTo.text;
navigateToURL(new URLRequest(s));
}
]]>
</fx:Script>
<fx:Declarations>
<!– Place non-visual elements (e.g., services, value objects) here –>
</fx:Declarations>
<s:Label text=”Send To” top=”40″ left=”50″/>
<s:TextInput id=”sendTo” top=”30″ left=”160″ text=”2125559999″ width=”250″/>
<s:Button id=”sendIt” label=”Send” click=”sendIt_clickHandler(event)” top=”110″
left=”160″/>
</s:Application>

Open a text message in the Messaging application

The Messenging application has opened


Posted

in

by

Tags: