Is it possible to obtain the SIM number in firemonkey(Delphi)?

Asked

Viewed 581 times

0

Is it possible to get the mobile number (SIM number) in the Firemonkey App? I’ve been searching on forums for a few hours and have not found any example the library that allows you to get the mobile number

1 answer

1


If it’s android:

uses
  Androidapi.JNI.Telephony;

var
  tMgr: JTelephonyManager;
  PhoneNumber: String;
begin
  tMgr := TJTelephonyManager.Wrap((SharedActivityContext.getSystemService(TJContext.JavaClass.TELEPHONY_SERVICE) 
as ILocalObject).GetObjectID);
  PhoneNumber := JStringToString(tMgr.getLine1Number);
end;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.