Add phone functionality to the app

You can generate the code to interact with the mobile device's features. This example shows how to call a selected phone number from the app.

  1. Open the appflow.4ba file.
  2. Right-click on the BA diagram and select New > Phone.
  3. Right-click on the Form entity and select Add Relation. Click on the Form entity again and drag the Relation arrow to the Phone entity.

    Screenshot of 4ba with phone entity related to form entity.
  4. Select the Relation between the Form and the Phone entity and set the Action property to callContact. Set the Phone Number property to the phone column (account.phone in our example database).


  5. Save your changes to appflow.4ba.
  6. Double-click on the Form entity to open it in Form Designer. Add a button that triggers your callContact action.
    1. Expand the canvas and the grid that is containing the form fields if you need room to add a button.
    2. Select Widget > Button from the menu.
    3. Draw a button onto your form. Set the name property of your button to callContact. The name of the button is also the action to be triggered by the button.
    4. Set the text property of the button to Call Contact.
  7. To preview your form, select Build > Preview.
  8. Make further changes to your form if you wish.
  9. Save your changes to the form.
  10. Execute your program, this will rebuild your program and execute it in one step.
  11. Test the new button.
    Tip: The sample data in the phone field is not a valid phone number. Run the app and select Modify to update the phone field with a phone number of your choice. On the Android emulator, the MENU button displays the available program actions.

    Screen shot of changing phone number and dialing.