Firemoneky android read_phone_state runtime permission asks to get IMEI

  

How can i get read_phone_state permission at runtime to get IMEI number?

if not HasPermission(‘android.permission.READ_PHONE_STATE’) then
begin

//ASK AND GET PERMISSION ?

end;

function TForm1.HasPermission(const Permission: string): Boolean;
begin
//Permissions listed at http://d.android.com/reference/android/Manifest.permission.html
{$IF RTLVersion >= 30}
Result := TAndroidHelper.Context.checkCallingOrSelfPermission(
{$ELSE}
Result := SharedActivityContext.checkCallingOrSelfPermission(
{$ENDIF}
StringToJString(Permission)) =
TJPackageManager.JavaClass.PERMISSION_GRANTED;

end;

Comments are closed.