1, new Muilti Device C + + Builder project, add 2 header files in. h:#include <fmx. Platform.hpp>#include <fmx. Phonedialer.hpp>2. Add Private declaration variable: _di_ifmxphonedialerservice phonedialerservice; (No add *, but type is pointer)__published declaration method: void __fastcall myoncallstatechanged (const unicodestring acallid,const tcallstate aCallState); 3, add the control to display, at this time the Edit to be used as a dial pad, so to setKeyboardtype = NumberpadReturnkeytype = GoKillfocusbyreturn = True4. In. cpp, write code for 2 buttons://Get carrier information, displayed in Label1 and Label2void __fastcall Tform3::button1click (tobject *sender)
{
this->label1->text=phonedialerservice->getcarrier ()->getcarriername ();
this->label2->text=phonedialerservice->getcarrier ()->getisocountrycode ();
}//Follow the number in the Edit to Dial
void __fastcall Tform3::button2click (tobject *sender)
{
Phonedialerservice->call (this->edit1->text);
}5. Write the code for the new method myoncallstatechanged:void __fastcall tform3::myoncallstatechanged (const unicodestring Acallid,
Const tcallstate acallstate)
{
switch (acallstate) {
Case Tcallstate::none:
label3->text= "" +acallid;
Break ;
Case tcallstate::connected:
Label3->text=l "There is a call" +acallid;
Break ;
Case tcallstate::D ialing:
label3->text=l "dialing" +ACALLID;
Break ;
Case tcallstate::D isconnected:
label3->text=l "Disconnect" +acallid;
Break ;
}
}6. Click the OnCreate event in the events section of the form to write the code:void __fastcall tform3::formcreate (tobject *sender)
{
Phonedialerservice=tplatformservices::current->getplatformservice (__uuidof (IFMXPhoneDialerService));
phonedialerservice->oncallstatechanged=myoncallstatechanged;
}7, after installing on the phone, enter the phone number in the dial pad, such as 10086, click to dial. Click on the 2 button, the contents of the first two labels can display the operator's name and code.
RAD Studio XE8 The phone's dialing function in the app