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 – Send Email

By Rich Tretola | January 6, 2011
28,343 views

Integration between AIR on Android and the OS couldn’t be easier. Here is a simple example of how to integrate with the mail client using URLRequest().

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
26
27
28
29
30
31
32
33
<?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="HomeView">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
   
   
    <fx:Script>
        <![CDATA[
            private function sendEmail(event:MouseEvent):void {
                var urlString:String = "mailto:";
                urlString += emailTo.text;
                urlString += "?subject=";
                urlString += subject.text;
                urlString += "&body=";
                urlString += body.text;
                navigateToURL(new URLRequest(urlString));
            }

        ]]>
    </fx:Script>
   
    <s:Label left="10" top="10" text="Email To:"/>
    <s:TextInput id="emailTo" left="135" right="10" top="10"/>
    <s:Label left="10" top="75" text="Subject:"/>
    <s:TextInput id="subject" left="135" right="10" top="75"/>
    <s:Label left="10" top="140" text="Message:"/>
    <s:TextArea id="body" left="135" right="10" top="140" bottom="70"/>
    <s:Button right="10" bottom="10" height="53" label="Send Mail"
              click="sendEmail(event)"/>
   
</s:View>

Here are the results:







Topics: ActionScript 3, Adobe AIR, android, Flex 4 | 9 Comments »

9 Responses to “AIR on Android OS Interactions – Send Email”

  1. Tweets that mention AIR on Android OS Interactions – Send Email | EverythingFlex: Flex & AIR -- Topsy.com Says:
    January 6th, 2011 at 11:47 am

    [...] This post was mentioned on Twitter by Rich Tretola. Rich Tretola said: Blogged: AIR on Android OS Interactions – Send Email http://bit.ly/dJpkhr [...]

  2. Jonathan Campos Says:
    January 6th, 2011 at 12:13 pm

    One thing I’ve noticed is that you HAVE to put ‘subject’ and ‘body’ in lowercase. The simulator will take uppercase and it will work, but the phones will only take lower case. So don’t get too imaginative there!

    Reply to this comment

  3. AIR on Android OS Interactions – Text or Call | EverythingFlex: Flex & AIR Says:
    January 7th, 2011 at 8:19 am

    [...] AIR on Android OS Interactions – Send Email [...]

  4. Matt Says:
    June 17th, 2011 at 11:02 am

    How about attaching an image like a screenshot of the app?

    Reply to this comment

    pinkee Reply:

    how to send an email via mail client with an attachment?

    Reply to this comment

  5. Marjan Says:
    July 26th, 2011 at 4:39 am

    how to send an email via mail client with an attachment?

    Reply to this comment

  6. Marjan Says:
    July 26th, 2011 at 4:41 am

    how to send an email via mail client with an attachment?
    Please Help Me!
    Thanks

    Reply to this comment

  7. Matt Says:
    August 7th, 2011 at 10:29 am

    Thanks, nice code!

    Reply to this comment

  8. saurabh Says:
    September 22nd, 2011 at 2:18 am

    HI,
    Is the sendEmail(event:MouseEvent):void function native to android.How canwe pas values to mxml files at runtime and build it in eclipse.
    Say i want to pass the string of “to” in the mail (like james@gmail.com, stiffany@yahoo.co.in or dud@hotmail.com) to the mxml file .is it possible.How.
    Rgds,
    S

    Reply to this comment

Comments