如何在Delphi中获取android版本(4.1.1,4.4.2,...)

Pis*_*ous 4 delphi android android-version delphi-xe5

我想获取 Android 设备的版本。在Java中是android.os.Build.VERSION.RELEASE,在Delphi中是怎样的?

RRU*_*RUZ 7

您可以使用该System.SysUtils.TOSVersion记录来获取有关运行应用程序的操作系统的信息。

  TOSVersion = record
  public type
    TArchitecture = (arIntelX86, arIntelX64, arARM32);
    TPlatform = (pfWindows, pfMacOS, pfiOS, pfAndroid, pfWinRT, pfLinux);
  public const
    AllArchitectures = [arIntelX86, arIntelX64, arARM32];
    AllPlatforms = [pfWindows, pfMacOS, pfiOS, pfAndroid, pfWinRT, pfLinux];
  private
    class var FArchitecture: TArchitecture;
    class var FBuild: Integer;
    class var FMajor: Integer;
    class var FMinor: Integer;
    class var FName: string;
    class var FPlatform: TPlatform;
    class var FServicePackMajor: Integer;
    class var FServicePackMinor: Integer;
    class constructor Create;
  public
    class function Check(AMajor: Integer): Boolean; overload; static; inline;
    class function Check(AMajor, AMinor: Integer): Boolean; overload; static; inline;
    class function Check(AMajor, AMinor, AServicePackMajor: Integer): Boolean; overload; static; inline;
    class function ToString: string; static;
    class property Architecture: TArchitecture read FArchitecture;
    class property Build: Integer read FBuild;
    class property Major: Integer read FMajor;
    class property Minor: Integer read FMinor;
    class property Name: string read FName;
    class property Platform: TPlatform read FPlatform;
    class property ServicePackMajor: Integer read FServicePackMajor;
    class property ServicePackMinor: Integer read FServicePackMinor;
  end;
Run Code Online (Sandbox Code Playgroud)