procedure TPhoneDialerForm.btnGetCarrierInfoClick(Sender: TObject);
var
PhoneDialerService: IFMXPhoneDialerService;
begin
{ test whether the PhoneDialer services are supported }
if TPlatformServices.Current.SupportsPlatformService(IFMXPhoneDialerService, IInterface(PhoneDialerService)) then
begin
{ if yes, then update the labels with the retrieved information }
CarrierNameItem.ItemData.Detail := PhoneDialerService.GetCarrier.GetCarrierName;
CountryCodeItem.ItemData.Detail := PhoneDialerService.GetCarrier.GetIsoCountryCode;
NetworkCodeItem.ItemData.Detail := PhoneDialerService.GetCarrier.GetMobileCountryCode;
MobileNetworkItem.ItemData.Detail := PhoneDialerService.GetCarrier.GetMobileNetwork;
end
else
ShowMessage('PhoneDialer service not supported');
end;
procedure TPhoneDialerForm.btnMakeCallClick(Sender: TObject);
var
PhoneDialerService: IFMXPhoneDialerService;
begin
{ test whether the PhoneDialer services are supported }
if TPlatformServices.Current.SupportsPlatformService(IFMXPhoneDialerService, IInterface(PhoneDialerService)) then
begin
{ if the Telephone Number is entered in the edit box then make the call, else
display an error message }
if edtTelephoneNumber.Text <> '' then
PhoneDialerService.Call(edtTelephoneNumber.Text)
else
begin
ShowMessage('Please type in a telephone number.');
edtTelephoneNumber.SetFocus;
end;
end
else
ShowMessage('PhoneDialer service not supported');
end;
Head over and check out the full source code for the Phone Dialer API demo for Delphi XE7 Firemonkey.