Tutorial 12 - How to invoke email application

What you will learn in this Tutorial

How to invoke email application

Download Source Code - Tutorials - Source for this tutorial is in appemble-tutorial-actions
Reference Actions, INVOKE_EMAIL action

Introduction

INVOKE_EMAIL action invokes the email application. Based on the input and target parameters, the email application is invoked with pre-filled value list such as to, cc, bcc, subject and body.

How to invoke email application

Lets create a screen emailactions.xml.

This screen allows a user to enter values of to, subject, body in the form. Tapping on Email button invokes the action INVOKE_EMAIL. The action prompts the user to select one of Email applications on the device. On selecting the Email application, the email form displays the values filled in. On Send or Cancel, the email application closes and the user returns back to the screen from which he/she opened the email application.

<screen name="emailactions" screen_type="SCREEN" allow_reorientation="true" allowed_layouts="BOTH" scroll="VERTICAL"
            width="100" height="100" menuOrder="2" menuName="Email" tab_group_name="tabgroup1">
            <title_controls>
                    <control type="TEXT" x="0" y="1" width="100" height="6" default_value="Test Actions"
                             appearance_name="white" data_type="VARCHAR">
                    </control>
                </title_controls>
            <controls>
                    <control type="TEXT" x="2" y="4" width="30" height="8" appearance_name="black" data_type="VARCHAR"
                                     default_value="To"/>
                    <control type="EDIT" x="35" y="4" width="60" height="8" appearance_name="edit_box" data_type="VARCHAR" field_name="sendto"
                                     size="80"/>
                    <control type="TEXT" x="2" y="14" width="30" height="8" appearance_name="black" data_type="VARCHAR"
                                     default_value="Subject"/>
                    <control type="EDIT" x="35" y="14" width="60" height="8"
                                     appearance_name="edit_box" data_type="VARCHAR" field_name="emailsubject"
                                     size="80"/>
                    <control type="TEXT" x="2" y="24" width="30" height="8" appearance_name="black" data_type="VARCHAR"
                                     default_value="body"/>
                    <control type="EDIT" x="35" y="24" width="60" height="15" appearance_name="edit_box" data_type="VARCHAR" field_name="emailbody"
                                     size="80"/>
                    <control type="PUSHBUTTON" x="35" y="43" width="60" height="8" appearance_name="blue_button" data_type="VARCHAR"
                                     default_value="INVOKE_EMAIL">
                                    <actions>
                                                 <action event_list="TAP" action_name="INVOKE_EMAIL"
                                                         target="" input_parameter_list="sendto,emailsubject,emailbody"
                                                         target_parameter_list="to,subject,body"/>
                                            </actions>
                            </control>

            </controls>
</screen>

Test the app. appemble-tutorial-actions. If you have not downloaded tutorial source code, click on Download Source Code - Tutorials

Android - Right click on appemble-tutorial-actions and click on Run as Android application.

iOS - Select scheme appemble-tutorial-actions and iPhone x.x simulator. Click on Product -> Run.

Enter to, subject and body. Tap INVOKE_EMAIL button. It invokes the email application.

Android

Note

  • On Android simulator this does not come properly. Test on device. When you tap on INVOKE_EMAIL, a list of email apps on your device will be displayed. Select the email app that you want to use.
../_images/email_form1.png ../_images/compose_email1.png

iOS Simulator

../_images/ios_email_form1.png ../_images/ios_email1.png