FMX.DeviceInfo Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample shows you how to obtain device information that includes OS version, OS name and device type.


You can find the DeviceInfo sample project at:

  • Start | Programs | Embarcadero RAD Studio Alexandria | Samples and then navigate to:
    • Object Pascal\Mobile Snippets\DeviceInfo
    • CPP\Mobile Snippets\DeviceInfo
  • Subversion Repository:
    • You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.


The DeviceInfo sample demonstrates how to obtain device information of an iOS or Android device. This sample uses the iOS or Android APIs to obtain the OS version, the OS name and the device type.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Delphi: DeviceInfo.dproj.
    • C++: DeviceInfo.cbproj.
  2. Select the target platform, iOS and Android supported.
  3. Press F9 or choose Run > Run.
  4. Click on the refresh tool button at the upper right corner to obtain the following device information:
    • OS Name
    • Device Type
    • OS Version


File in Delphi File in C++ Contains



The project itself.



The main form where the components are located.


DeviceInfoPCH.h, TapAndHold.cpp

Used to define and implement the sample.



Further information about the sample.


TDeviceInfoForm is the main form that represents the main window of the sample. It contains the following components:


  • The sample uses TListBox to display a set of information items related with the device and the OS.
  • The sample uses each TListBoxItem to display each information item.
  • The sample uses a TButton component called btnGetDeviceInfo to call the OnClick event that is used to get the device information.

When you run the application, you can see at the upper right corner a button with the StyleLookup set to refreshtoolbuttonbordered. Click on it to obtain the following information of your device:

  • OS Name
  • Device Type
  • OS Version


The sample uses Built-in Java libraries for Android

  • androidapi.JNI.JavaTypes
  • androidapi.Helpers
  • androidapi.JNI.Os

The sample uses iOS Objective-C Frameworks

  • iOSapi.UIKit
  • iOSapi.Foundation
  • Macapi.Helpers

See Also