Package | com.distriqt.extension.application |
Interface | public interface Device extends flash.events.IEventDispatcher |
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.
Property | Defined By | ||
---|---|---|---|
brand : String [read-only]
The consumer-visible brand with which the product/hardware will be associated, if any. | Device | ||
device : String [read-only]
| Device | ||
deviceOrientation : String [read-only]
| Device | ||
displayMetrics : DisplayMetrics [read-only] | Device | ||
isiOSAppOnMac : Boolean [read-only]
Whether this application is an iOS app running on a Mac
| Device | ||
locale : Locale [read-only]
Access to the current locale settings on the device
| Device | ||
localTimeZone : TimeZone [read-only]
Access to the current system time zone on the device
| Device | ||
manufacturer : String [read-only]
The manufacturer of the product/hardware. | Device | ||
model : String [read-only]
The end-user-visible name for the end product. | Device | ||
name : String [read-only]
| Device | ||
os : OperatingSystem [read-only]
Details about the operating system of the device. | Device | ||
phone : String [read-only]
The phone number of the device. | Device | ||
product : String [read-only]
The name of the overall product. | Device | ||
yearClass : int [read-only]
Year Class implements a simple algorithm that maps a device's RAM, CPU cores, and clock speed to the year
where those combination of specs were considered high end. | Device |
Method | Defined By | ||
---|---|---|---|
getExternalFilesDir():String
Android
Returns absolute paths to application-specific directories on all shared/external
storage devices where the application can place persistent files it owns. | Device | ||
getFilesDir():String
Android
Returns the absolute path to the directory on the filesystem where files created with openFileOutput(String, int) are stored. | Device | ||
isAutoTimeEnabled():Boolean
Returns true if the device currently has the auto time preference checked. | Device | ||
isAutoTimeZoneEnabled():Boolean
Returns true if the device currently has the auto time zone preference checked. | Device | ||
isDeviceIdleMode():Boolean
Returns true if the device is currently in idle mode. | Device | ||
isPowerSaveMode():Boolean
Returns true if the device is currently in power save mode. | Device | ||
startGeneratingDeviceOrientationEvents():Boolean
Starts monitoring the device orientation and the dispatching of
DeviceOrientationEvent's when the orientation of the device
is changed. | Device | ||
stopGeneratingDeviceOrientationEvents():Boolean
Stops monitoring the device orientation. | Device | ||
uniqueId(type:String, persistent:Boolean = false, callback:Function = null):String
Retrieves a unique device ID from the underlying platform. | Device |
brand | property |
brand:String
[read-only]
The consumer-visible brand with which the product/hardware will be associated, if any.
public function get brand():String
device | property |
device:String
[read-only]
public function get device():String
deviceOrientation | property |
deviceOrientation:String
[read-only]
public function get deviceOrientation():String
displayMetrics | property |
displayMetrics:DisplayMetrics
[read-only] public function get displayMetrics():DisplayMetrics
isiOSAppOnMac | property |
isiOSAppOnMac:Boolean
[read-only] Whether this application is an iOS app running on a Mac
public function get isiOSAppOnMac():Boolean
locale | property |
locale:Locale
[read-only] Access to the current locale settings on the device
public function get locale():Locale
localTimeZone | property |
localTimeZone:TimeZone
[read-only] Access to the current system time zone on the device
public function get localTimeZone():TimeZone
manufacturer | property |
manufacturer:String
[read-only]
The manufacturer of the product/hardware.
public function get manufacturer():String
model | property |
model:String
[read-only] The end-user-visible name for the end product.
public function get model():String
name | property |
name:String
[read-only]
public function get name():String
os | property |
os:OperatingSystem
[read-only]
Details about the operating system of the device.
public function get os():OperatingSystem
phone | property |
phone:String
[read-only]
The phone number of the device.
public function get phone():String
product | property |
product:String
[read-only]
The name of the overall product.
On Apple devices this is the hardware string eg iPhone8,3
public function get product():String
yearClass | property |
yearClass:int
[read-only]
Year Class implements a simple algorithm that maps a device's RAM, CPU cores, and clock speed to the year
where those combination of specs were considered high end.
This allows a developer to easily modify application behavior based on the capabilities of the phone's hardware.
If the extension cannot determine the year of the device -1
will be returned.
Generally this indicates that the device is newer than our algorithm allows for, so you can
use your top performance level, however you may choose to use other methods to determine it
yourself.
public function get yearClass():int
getExternalFilesDir | () | method |
public function getExternalFilesDir():String
Android Returns absolute paths to application-specific directories on all shared/external storage devices where the application can place persistent files it owns. These files are internal to the application, and not typically visible to the user as media. No additional permissions are required for the calling app to read or write files under the returned path. Write access outside of these paths on secondary external storage devices is not available. The returned path may change over time if different shared storage media is inserted, so only relative paths should be persisted. Android documentation: https://developer.android.com/reference/android/content/Context#getExternalFilesDirs(java.lang.String)
ReturnsString — native absolute path
|
getFilesDir | () | method |
public function getFilesDir():String
Android
Returns the absolute path to the directory on the filesystem where files created with openFileOutput(String, int) are stored.
See https://developer.android.com/reference/android/content/Context.html#getFilesDir()
iOS defaultReturns File.applicationStorageDirectory.nativePath - a storage directory unique to each installed AIR application.
Each AIR application has a unique, persistent application storage directory, which is created when you first access File.applicationStorageDirectory. This directory is unique to each application and user. This directory is a convenient location to store user-specific or application-specific data.
ReturnsString — Native absolute path
|
isAutoTimeEnabled | () | method |
public function isAutoTimeEnabled():Boolean
Returns true
if the device currently has the auto time preference checked.
Supported on Android devices.
Will return false
on unsupported devices.
Boolean — |
isAutoTimeZoneEnabled | () | method |
public function isAutoTimeZoneEnabled():Boolean
Returns true
if the device currently has the auto time zone preference checked.
Supported on Android devices.
Will return false
on unsupported devices.
Boolean — |
isDeviceIdleMode | () | method |
public function isDeviceIdleMode():Boolean
Returns true
if the device is currently in idle mode.
This happens when a device has been sitting unused and unmoving for a sufficiently
long period of time, so that it decides to go into a lower power-use state.
This may involve things like turning off network access to apps.
You can monitor for changes to this state with `DeviceStateEvent.IDLE_MODE_CHANGED`.
Supported on Android devices with API v23 or higher. Will return false on unsupported devices. ReturnsBoolean — Returns true if currently in active device idle mode, else false
|
isPowerSaveMode | () | method |
public function isPowerSaveMode():Boolean
Returns true
if the device is currently in power save mode.
When in this mode, applications should reduce their functionality
in order to conserve battery as much as possible.
You can monitor for changes to this state with `DeviceStateEvent.POWER_SAVE_MODE_CHANGED`.
ReturnsBoolean — |
startGeneratingDeviceOrientationEvents | () | method |
public function startGeneratingDeviceOrientationEvents():Boolean
Starts monitoring the device orientation and the dispatching of
DeviceOrientationEvent
's when the orientation of the device
is changed.
These events are dispatched even if your UI is locked to an orientation
ReturnsBoolean — true if successful and false otherwise
|
stopGeneratingDeviceOrientationEvents | () | method |
public function stopGeneratingDeviceOrientationEvents():Boolean
Stops monitoring the device orientation.
ReturnsBoolean — true if successful and false otherwise
|
uniqueId | () | method |
public function uniqueId(type:String, persistent:Boolean = false, callback:Function = null):String
Retrieves a unique device ID from the underlying platform. Generally this is a sanctioned ID however you should consult the particular platform documentation regarding the usage of the ID.
The default operation of this function is to retrieve an ID that you can use in your application to identify a user's device.
Android On Android the function returns the Settings.Secure.ANDROID_ID. A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device. The value may change if a factory reset is performed on the device. We suggest using the service identifier on Android which retrieves the "App set ID" asynchronously (https://developer.android.com/training/articles/app-set-id). iOSOn iOS there are several ID's currently available. See the types for more information of them. Generally the default "vendor" ID should be sufficient for most developer needs.
If you wish the ID to be more persistent than Apple currently supplies
you can use this function to automatically store and retrieve the first
ID you generate in the device Keychain. Subsequent calls to this function
will retrieve the value from the Keychain as opposed to requesting the
native supplied ID. This is controlled by the persistent
parameter. If true the value is retrieved / saved to the Keychain, or,
if false, the normal native supplied ID is returned.
Parameters
type:String (default = NaN ) — The type of id to retrieve. See the available types
below. [default: VENDOR]
(iOS only, Android always returns the ANDROID_ID)
| |
persistent:Boolean (default = false ) — (iOS only) If true, the first generated id is saved into the device keychain which will persist between application installations, this value is then returned on subsequent calls to this function.
If false, the value of the requested id type is always returned.
| |
callback:Function (default = null ) — On Android if using IDType.SERVICE the retrieval of the ID is asynchronous, so this callback function
will be called with the uniqueId when the retrieval is complete. This will be triggered in all cases.
|
String — A string with the requested unique device id, callback will be called with the latest identifier and should be used over the return value.
|
See also