Delphi XE6 Android 小试牛刀{发短信,打电话}

单元引用


uses Androidapi.Helpers, Androidapi.JNI.Telephony, FMX.PhoneDialer;

Function SendSMS(szTel, szText:string):Boolean;
Var//发送短信
  lpSend  :JSmsManager;
begin
  lpSend := TJSmsManager.Create;
  lpSend.sendTextMessage(StringToJString(szTel), Nil, StringToJString(szText), Nil, Nil);
  Result := True;
end;

Function CallTel(szTel:string):Boolean;
Var//拨打电话
  lpPhone :IFMXPhoneDialerService;
begin
  if TPlatformServices.Current.SupportsPlatformService(IFMXPhoneDialerService, IInterface(lpPhone)) then
  begin
    lpPhone.Call(szTel);
  end;
  Result := True;
end;



04c0ba22720e0cf345f58ccb0846f21fbe09aa17.jpg


标签: delphi, xe6, android, call tel, send sms

添加新评论