I would like to get the version of the Android device. In Java it is android.os.Build.VERSION.RELEASE, how is it in Delphi?
Asked
Active
Viewed 2,494 times
4
-
possibly duplicate question... http://stackoverflow.com/questions/10547818/androidhow-to-find-the-android-version-name-programmatically – Bhaskar Apr 03 '14 at 13:29
-
2not really, i need it for Delphi XE5 – Piskous Apr 03 '14 at 13:43
-
See the Samples\MobileCodeSnippets\Delphi\DeviceInfo project, which not only shows the build (eg., 4.1.2) but the common name ("Ice Cream Sandwich MR1") and device name ("Samsung Galaxy S3") as well. – Ken White Apr 03 '14 at 15:13
2 Answers
7
You can use the System.SysUtils.TOSVersion
record to get information about the operating system on which your application runs.
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;

RRUZ
- 134,889
- 20
- 356
- 483
1
Use the code
if TOSVersion.Check(4, 2) then
It will be true if Android OS version is 4.2.2 (API 17) or higher.

Pax Beach
- 2,059
- 1
- 20
- 27