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.

Location

You can find the DeviceInfo sample project at:

Description

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

Files

File in Delphi File in C++ Contains

DeviceInfo.dproj

DeviceInfo.cbproj

The project itself.

uMain.fmx

uMain.fmx

The main form where the components are located.

uMain.pas

DeviceInfoPCH.h, TapAndHold.cpp

Used to define and implement the sample.

Information.txt

Information.txt

Further information about the sample.

Clases

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

Implementation

  • 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

Uses

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

Personal tools
Assistance