FMX.PhoneDialer Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample demonstrates how to use the PhoneDialer API in order to make a phone call and to obtain the carrier information.

Location

You can find the PhoneDialer sample project at:

  • Start | Programs | Embarcadero RAD Studio Alexandria | Samples and then navigate to:
    • Object Pascal\Mobile Snippets\PhoneDialer
    • CPP\Mobile Snippets\PhoneDialer
  • Subversion Repository:
    • You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

Description

The PhoneDialer sample demonstrates how to use the PhoneDialer API in order to make a phone call on Android and iOS devices. The sample uses IFMXPhoneDialerService.GetCarrier to obtain the carrier information and IFMXPhoneDialerService.Call to make a phone call.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Delphi: PhoneDialer.dproj.
    • C++: PhoneDialer.cbproj.
  2. Select the target platform, iOS and Android supported.
  3. Press F9 or choose Run > Run.
  4. Interact with the sample:
    • Click on the Get Carrier Info button to see the following carrier information: Carrier Name, ISO Country Code, Network Code and Mobile network.
    • Write the Phone number on the box under the Telephone Number label.
    • Click on the Make Call button to make a phone call.

Files

File in Delphi File in C++ Contains

PhoneDialer.dproj

PhoneDialer.cbproj

The project itself.

uMain.fmx

uMain.fmx

The main form where the components are located.

uMain.pas

PhoneDialerPCH.h, PhoneDialer.cpp

Used to define and implement the sample.

Information.txt

Information.txt

Further information about the sample.

Classes

TPhoneDialerForm is the main form that represents the main window of the sample. It contains the following components:

Implementation

  • The sample uses TListBox to display a set of items with the carrier information.
  • The sample uses TButton to activate different IFMXPhoneDialerService methods.
  • The sample uses TEdit to create an edit box to enter the phone number to which the user is going to call.

When you run the application, there are four TListBoxItems, two TButtons and a TEdit box. If you click the Get Carrier Info button, the four TListBoxItems are filled with the carrier information. Moreover, if you want to make a phone call, you have to introduce the phone number into the TEdit box under the Telephone Number label and click on the make Call button.

Uses

See Also