Device functionality allows you to retrieve information about the device.
There are many pieces of information available through the Device interface that allow you to determine what device you are currently running on, including things like the operating system version and the device model.
name: The name of the device, generally this is a user set name for their device, eg
brand: The consumer-visible brand with which the product/hardware will be associated, if any, eg
manufacturer: The manufacturer of the product/hardware, eg
device: The device type, ie. a simple name for the device eg
model: The end-user-visible name for the end product eg
product: The name of the overall product hardware, eg
For example, the following on an iPhone 11
trace( "DEVICE INFO ============================" );
trace( " name: " + Application.service.device.name );
trace( " brand: " + Application.service.device.brand );
trace( " manufacturer: " + Application.service.device.manufacturer );
trace( " device: " + Application.service.device.device );
trace( " model: " + Application.service.device.model );
trace( " product: " + Application.service.device.product );
DEVICE INFO ============================
name: My iPhone
model: iPhone 11
The device locale settings can be retrieved through the
var locale:Locale = Application.service.device.locale
This object contains information about the device locale:
locale.country: The country/region code for this locale, which should either be the empty string, an uppercase ISO 3166 2-letter code, or a UN M.49 3-digit code;
locale.language: The language code of this Locale, or the empty string if none is defined
trace( "PATHS ==================================" );
trace( "files dir: " + Application.service.device.getFilesDir() );
trace( "ext files dir: " + Application.service.device.getExternalFilesDir() );
The returned values are native paths to common storage locations for Android applications. Generally no additional file permissions are required to read and write to these locations.
You can access information about the current system time zone on the device using the
var timezone:TimeZone = Application.service.device.localTimeZone;
TimeZone class represents a time zone offset indicating the standard time policies for a geopolitical region.
Time zones have identifiers like
"America/Los_Angeles" which can be accessed through the
var timezoneId:String = Application.service.device.localTimeZone.id;
You can also access the offset from UTC using the
utcOffset property. This gives you the amount of time in milliseconds to add to UTC to get standard time in this time zone.
var utcOffset:Number = Application.service.device.localTimeZone.utcOffset;
You can check whether the user has enabled automatic time / time zone settings on their device using the
isAutoTimeEnabled() and the
var autoTime:Boolean = Application.service.device.isAutoTimeEnabled();
This can be useful if you are attempting to check the accuracy of the time on the device (for example, to check if the user is attempting to cheat some time based operations in your game or app).
Available on Android only.
These will return
falseon all unsupported platforms.