• delphi for android 获取手机号


    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

  • 相关阅读:
    Mongodb 的ORM框架 Morphia之注解
    Redis主从集群及哨兵模式
    Dubbo
    Zookeeper
    使用Dockerfile自定义一个包含centos,tomcat的镜像
    linux/centOS 下安装 ngnix
    Session共享
    Linux安装jdk.18和tomcat8
    MongoDB集群的搭建
    多态--方法重写的三个要点
  • 原文地址:https://www.cnblogs.com/findumars/p/6358495.html
Copyright © 2020-2023  润新知