//电话信息(Call拨号)
PhoneDialerService: IFMXPhoneDialerService;//获取电话服务信息
procedureTPhoneDialerForm.btnGetCarrierInfoClick(Sender: TObject);varPhoneDialerService: 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
elseShowMessage('PhoneDialer service not supported');end;//拨号
procedureTPhoneDialerForm.btnMakeCallClick(Sender: TObject);varPhoneDialerService: 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 <> '' thenPhoneDialerService.Call(edtTelephoneNumber.Text)else
beginShowMessage('Please type in a telephone number.');
edtTelephoneNumber.SetFocus;end;end
elseShowMessage('PhoneDialer service not supported');end;
Intent :TJIntentusesAndroidapi.JNI.GraphicsContentViewText, FMX.Helpers.Android, Androidapi.JNI.Net, Androidapi.Helpers;
procedureCall_URI(constAAction : JString;constAURI:string);varuri: Jnet_Uri;
Intent: JIntent;beginuri :=StrToJURI(AURI);
Intent :=TJIntent.JavaClass.init(AAction, uri);{Intent.putExtra()
//短信
Call_URI(TJIntent.JavaClass.ACTION_SENDTO, 'smsto:137114553XX');
Intent.putExtra(StringToJString('sms_body'), StringToJString('测试短信'));
如果是要发短信等复杂的应用,需要传递各种其他的参数.要用到Intent.putExtra()传递多个参数.
这里只封装最简单的,具体Intent.putExtra()的用法,可以查询Java的资料.大把的}SharedActivityContext.startActivity(Intent);end;//使用例子://打电话
Call_URI(TJIntent.JavaClass.ACTION_CALL, 'tel:137114553XX');//打开地图显示某个坐标点
Call_URI(TJIntent.JavaClass.ACTION_VIEW, 'geo:38.899533,-77.036476');//打开网页
Call_URI(TJIntent.JavaClass.ACTION_VIEW, 'www.baidu.com');//发送电子邮件
Call_URI(TJIntent.JavaClass.ACTION_SENDTO, 'mailto:wr960204@126.com');//播放音乐
Call_URI(TJIntent.JavaClass.ACTION_VIEW, 'file:///sdcard/download/最炫民族风.mp3');