Transfer: Delphi D10.X Android APP development to obtain hardware information and mobile phone number

TJBuild
contains more equipment information

BOARD motherboard
BOOTLOADER system startup program version number
BRAND system customizer
CPU_ABI cpu instruction set
CPU_ABI2 cpu instruction set 2
DEVICE device driver name
DISPLAY display parameters, device display version package (displayed as the version number in the system settings) and ID
FINGERPRINT identification The code (this code is not the only code) is usually a combination of a series of parameters, it does not make much sense
HARDWARE hardware name
HOST device host address
MANUFACTURER hardware manufacturer
MODEL version is the name visible to the end user
PRODUCT The name of the entire product
RADIO radio firmware version: use ** getRadioVersion () ** instead.
SERIAL hardware serial number
TAGS describes build tags, such as unsigned, debug, etc.
TIME System compilation time
TYPE The type of compilation
USER is fixed, meaningless

    // Mobile phone model (MI XXX) 
    Memo1.Lines.Add ( ' Mobile phone model (MI XXX): ' + JStringToString (TJBuild.JavaClass.MODEL));
     // Device board name 
    Memo1.Lines.Add ( ' Device board name: ' + JStringToString (TJBuild.JavaClass.BOARD));
     // System startup program version 
    Memo1.Lines.Add ( ' System startup program version: ' + JStringToString 
      (TJBuild.JavaClass.BOOTLOADER)); 
    // System customizer 
    Memo1.Lines .Add ( ' Device brand: ' + JStringToString (TJBuild.JavaClass.BRAND));
     // cpu instruction set
    Memo1.Lines.Add ( ' cpu instruction set: ' + JStringToString (TJBuild.JavaClass.CPU_ABI));
     // cpu instruction set 2 
    Memo1.Lines.Add ( ' cpu instruction set 2: ' + JStringToString (TJBuild.JavaClass.CPU_ABI2 ));
     // Device driver name 
    Memo1.Lines.Add ( ' Device driver name: ' + JStringToString (TJBuild.JavaClass.DEVICE));
     // The version package displayed by the device (displayed as the version number in the system settings) and ID Same as 
    Memo1.Lines.Add ( ' Display parameters: ' + JStringToString (TJBuild.JavaClass.DISPLAY));
     // Device manufacturer 
    Memo1.Lines.Add ( 'Device manufacturer: ' + JStringToString (TJBuild.JavaClass.MANUFACTURER));
     // Radio firmware version 
    Memo1.Lines.Add ( ' Radio firmware version: ' + JStringToString 
      (TJBuild.JavaClass.getRadioVersion)); 
    // Unique identification of the device . It is composed of multiple pieces of information of the device. Note that this code is not the only code 
    Memo1.Lines.Add ( ' Hardware identification code (this code is not the only code): ' + 
      JStringToString (TJBuild.JavaClass.FINGERPRINT)); 
————————————— ——— 
Copyright Statement: This article is an original article of CSDN blogger "tanqth", following the CC 4.0 BY- SA copyright agreement. Please attach the original source link and this statement for reprint. 
Original link: https: // blog.csdn.net/tanqth/java/article/details/104779089

TelephonyManager

This part includes mobile phone information such as card slot information, mobile phone card information, operator information, network information, etc., and only a part of the main content is listed in the demo.

    TelephonyServiceNative := TAndroidHelper.Context.getSystemService
      (TJContext.JavaClass.TELEPHONY_SERVICE);
    if Assigned(TelephonyServiceNative) then
    begin
      Memo1.Lines.Add('======================');
      try
        TelephonyManager := TJTelephonyManager.Wrap
          ((TelephonyServiceNative as ILocalObject).GetObjectID);
        // 手机卡槽数
        vPhoneCount := TelephonyManager.getPhoneCount;
        Memo1.Lines.Add('卡槽数:' + vPhoneCount.ToString);
        // 插卡数
        vSubscriptionManager := TJSubscriptionManager.JavaClass.from
          (TAndroidHelper.Context);
        vSubManagerCoun :=
          vSubscriptionManager.getActiveSubscriptionInfoCount();
        Memo1.Lines.Add('插卡数:' + vSubManagerCoun.ToString);

        // 设备ID
        Memo1.Lines.Add('DeviceId_1:' + JStringToString
          (TelephonyManager.getDeviceId(0)));
        if vPhoneCount > 1 then
          Memo1.Lines.Add('DeviceId_2:' +
            JStringToString(TelephonyManager.getDeviceId(1)));
        // 硬件Imei
        Memo1.Lines.Add('Imei_1:' + JStringToString
          (TelephonyManager.getImei(0)));
        if vPhoneCount > 1 then
          Memo1.Lines.Add('Imei_2:' + JStringToString
            (TelephonyManager.getImei(1)));
        // 硬件Meid
        try
          Memo1.Lines.Add('Meid_1:' + JStringToString
            (TelephonyManager.getMeid(0)));
        except
          on E: Exception do
        end;

        try
          if vPhoneCount > 1 then
            Memo1.Lines.Add('Meid_2:' + JStringToString
              (TelephonyManager.getMeid(1)));
        except
          on E: Exception do
        end;

        // SubscriberId
        Memo1.Lines.Add('SubscriberId(IMSI号):' +
          JStringToString (TelephonyManager.getSubscriberId)); 
        // Line1Number 
        Memo1.Lines.Add ( ' Line1Number: ' + JStringToString 
          (TelephonyManager.getLine1Number)); 
        // Take the information of each card slot separately 
        for I: = 0  to vSubManagerCoun- 1  do 
        begin 
        vSubscriptionInfo : = vSubscriptionManager.getActiveSubscriptionInfo (I + 1 ); 
        Memo1.Lines.Add (I.ToString + ' Mobile Number: ' + JStringToString 
          (vSubscriptionInfo.getNumber));
        Memo1.Lines.Add (I.ToString + 'Use card slot: ' + (vSubscriptionInfo.getSimSlotIndex + 1 ) .ToString); 
        Memo1.Lines.Add (I.ToString + ' Operator: ' + JCharSequenceToStr 
          (vSubscriptionInfo.getCarrierName)); 
        end ; 

      except 
      end ;
     end ; 
------ ————————————— 
Copyright Statement: This article is an original article of CSDN blogger "tanqth", following the CC 4.0 BY- SA copyright agreement, please attach the original source link and this statement. 
Original link: https: // blog.csdn.net/tanqth/java/article/details/104779089

 

Guess you like

Origin www.cnblogs.com/timba1322/p/12681573.html