Thursday, 10 June 2021

Capture Android Device IMEI Delphi

Using Delphi 10.3 to develop Android application for capturing device IMEI and option setting

var

  MainForm: TMainForm;


implementation

uses System.Permissions, AndroidAPI.JNI.Telephony, AndroidAPI.Helpers, AndroidAPI.JNI.OS;


{$R *.fmx}


procedure TMainForm.btnCaptureIMEIClick(Sender: TObject);

var

   jTM : JTelephonyManager;

begin

  jTM:=  TJTelephonyManager.Create;

  Text1.Text :=  JStringtoString(jTM.getImei);

end;


procedure TMainForm.FormCreate(Sender: TObject);

var

  lPermissionTelState : string;

begin

  lPermissionTelState := JStringtoString(TJManifest_permission.Javaclass.READ_PHONE_STATE);

  PermissionsService.RequestPermissions([lPermissionTelState], nil, nil);

end;



No comments:

Post a Comment