码迷,mamicode.com
首页 > 移动开发 > 详细

delphi for android 获取手机号

时间:2017-01-30 23:43:58      阅读:532      评论:0      收藏:0      [点我收藏+]

标签:获取手机号   ase   oca   ber   std   sign   oid   man   assign   

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,Androidapi.JNI.GraphicsContentViewText,
   Androidapi.JNIBridge,  Androidapi.JNI.Telephony, Androidapi.JNI.JavaTypes,
    FMX.Helpers.Android, FMX.StdCtrls;


type
  TForm1 = class(TForm)
    btn1: TButton;
    lbl1: TLabel;
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  TelephonyManager: JTelephonyManager;
  TelephonyServiceNative: JObject;

implementation

{$R *.fmx}

procedure TForm1.btn1Click(Sender: TObject);
begin
  TelephonyServiceNative := SharedActivityContext.getSystemService
    (TJContext.JavaClass.TELEPHONY_SERVICE);
  if Assigned(TelephonyServiceNative) then
    TelephonyManager := TJTelephonyManager.Wrap
      ((TelephonyServiceNative as ILocalObject).GetObjectID);
  lbl1.Text:=JStringToString(TelephonyManager.getLine1Number);//取得手机号

end;

 

http://blog.csdn.net/syndicater/article/details/19325305

delphi for android 获取手机号

标签:获取手机号   ase   oca   ber   std   sign   oid   man   assign   

原文地址:http://www.cnblogs.com/findumars/p/6358495.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!