Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++

Top Five Android And IOS Device Sensors You Can Easily Access From FireMonkey

RAD Studio in FireMonkey provides access to a variety of device sensors on Android and iOS. Six different demos show how to easily access a variety of these various sensors. The demos include the Gyroscope, Accelerometer, AccessCameraApp/CameraComponent, Location, and OrientationSensor. These demos make use of the TOrientationSensor, TLocationSensor, TMotionSensor, TCameraComponent, and TTakePhotoFromCameraAction components.

The Gyroscope sample demonstrates how to use the Gyroscope in order to rotate a 3D cube when your device is tilted. This sample suports both iOS or Android devices. The sample uses the TOrientationSensor component and the TCustomOrientationSensor class to act like a gyroscope that rotates a 3D cube while you tilt your device.

The Accelerometer sample demonstrates how to use the accelerometer in iOS or Android applications. The sample uses TMotionSensor component and TCustomMotionSensor class to offer information about the acceleration, angle, state, and speed of the device motion.

The Location sample demonstrates how to use the location sensor of the device on iOS applications. The sample uses TLocationSensor to offer information about the GPS location of the device. Moreover, the sample displays the location of the device on Google Maps using TWebBrowser.

The AccessCameraApp sample shows how to use TTakePhotoFromCameraAction to open the camera application on your iOS or Android device, take a picture and retrieve the taken image to display it on your FireMonkey form. The TTakePhotoFromCameraAction component uses the native device dialog of capturing a photo. The TCameraComponent (a nonvisual component for a camera device) sample project shows how to manipulate the camera of a device, and how to set preset and custom quality capture settings for your camera. With this sample you can: Turn on and off the camera of your device. Select either the front facing camera or the back facing camera. Set different resolution configurations for your camera. Select whether to turn the flash on, off, or leave it in automatic mode.

The OrientationSensor sample demonstrates how to use the orientation sensor in iOS or Android applications. The sample uses the TOrientationSensor component and the TCustomOrientationSensor class to offer information about the rotation angle (tilt) and the compass heading relative to the magnetic north (heading).

Head over to check out the SensorInfo demo which displays the status of all the different sensors on your device.

Interested in building an app that supports Android and IOS devices? Try out the Windows IDE and make the most of it. Request a Free Trial here.


See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

FMXExpress.com has over 600 articles with all kinds of tips and tricks for Delphi FireMonkey on Android, IOS, OSX, Windows, and Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES