zoukankan      html  css  js  c++  java
  • delphi for android 获取手机号

    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;
    
    ---------------------
  • 相关阅读:
    web十二讲,CSS样式
    web第十一讲,div与span
    web第十讲,CSS基础
    git 版本回退后再恢复
    git 变更远程仓库及在本地的别名
    使用FastClick插件,无法监听双击事件
    声明式编程的没落
    gradle 很棒
    评 PowerShell
    VB 的一些歧义(不断更新)
  • 原文地址:https://www.cnblogs.com/m0488/p/9750790.html
Copyright © 2011-2022 走看看