Tutorial 10 - How to invoke phone application

What you will learn in this Tutorial

How to use CALL_PHONE action

How to use PLACE_CALL action

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

Introduction

CALL_PHONE and PLACE_CALL are two actions using which you can invoke phone application. The difference between the two actions is

CALL_PHONE - Invokes phone application and asks user permission to dial the number or not. PLACE_CALL -Invokes phone application and directly dials the phone number.

Based on your requirement, you can use either of the actions.

How to use CALL_PHONE action

Lets create a screen phone_actions.xml, which takes phone number as input. Tapping on a button invokes CALL_PHONE action.

 <screen name="phoneactions" screen_type="SCREEN" allow_reorientation="true" allowed_layouts="BOTH" scroll="VERTICAL"
         width="100" height="100" menuOrder="0" menuName="Phone" 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="3" width="25" height="8" appearance_name="black" data_type="VARCHAR"
                                  word_wrap="1" default_value="Phone number:" />
                 <control type="EDIT" x="35" y="3" width="60" height="8" appearance_name="edit_box" data_type="VARCHAR"
                                  field_name="phone_no_to_call" size="80" keyboard_type="PHONE"/>
                 <control type="PUSHBUTTON" x="35" y="13" width="60" height="8" appearance_name="blue_button" data_type="VARCHAR"
                                  default_value="CALL_PHONE">
                                 <actions>
                                              <action event_list="TAP" action_name="CALL_PHONE"
                                                      target="" input_parameter_list="phone_no_to_call" target_parameter_list="phone_number"/>
                                         </actions>
                         </control>
     </controls>
 </screen>

Note

target_parameter_list=”phone_number” (This is mandatory and cannot be changed)

You can test the action using 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 the phone number and tap on button CALL_PHONE. It invokes the application with the number pre-filled. You can decide, whether to place the call or not.

How to use PLACE_CALL action

In the above code, lets replace the name of the button to PLACE_CALL and action_name=”PLACE_CALL”

 <screen name="phoneactions" screen_type="SCREEN" allow_reorientation="true" allowed_layouts="BOTH" scroll="VERTICAL"
         width="100" height="100" menuOrder="0" menuName="Phone" 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="3" width="25" height="8" appearance_name="black" data_type="VARCHAR"
                                  word_wrap="1" default_value="Phone number:" />
                 <control type="EDIT" x="35" y="3" width="60" height="8" appearance_name="edit_box" data_type="VARCHAR"
                                  field_name="phone_no_to_call" size="80" keyboard_type="PHONE"/>
                 <control type="PUSHBUTTON" x="35" y="13" width="60" height="8" appearance_name="blue_button" data_type="VARCHAR"
                                  default_value="PLACE_CALL">
                                 <actions>
                                              <action event_list="TAP" action_name="PLACE_CALL"
                                                      target="" input_parameter_list="phone_no_to_call" target_parameter_list="phone_number"/>
                                         </actions>
                         </control>
     </controls>
 </screen>

You can test the action using 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 the phone number and tap on button PLACE_CALL. It invokes the application and dials the number you entered.