业无高卑志当坚,男儿有求安得闲?这篇文章主要讲述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;
【delphi for android 获取手机号】http://blog.csdn.net/syndicater/article/details/19325305
推荐阅读
- Delphi使用android的NDK是通过JNI接口,封装好了,不用自己写本地代码,直接调用
- 给需要搭建Android studio的新手们!·
- 影梭Android版使用教程
- Android 逆向工程 实践篇
- 一起学Google Daydream VR开发,快速入门开发基础教程一(Android端开发环境配置一)
- HBuilder 获取通话记录 (Android)
- Android开发(《Gradle Recipes for Android》阅读笔记1.3)
- Android学习笔记 布局基础
- Android开发(《Gradle Recipes for Android》阅读笔记1.2)