qnx.system.Device

Device

Properties | Methods | Events


Packageqnx.system
Classpublic class Device
InheritanceDevice Inheritance flash.events.EventDispatcher

The Device class exposes many properties of the device. Use the public static method Device.device to retrieve a reference to the current device.

Class information:
BlackBerry 10 Version:   10.0.0

See also

Device.device



Public Properties

 PropertyDefined By
  batteryLevel : int
[read-only] Returns the battery level of the device.
Device
  batteryMonitoringEnabled : Boolean
Turns battery monitoring on or off.
Device
  batteryState : int
[read-only] Returns the battery state of the device.
Device
  device : Device
[static] [read-only] Gets a Singleton Device instance.
Device
  hardwareID : int
[read-only] Returns the Hardware ID of the device.
Device
  isOLED : Boolean
[read-only] Returns true if the device the application is running on has an OLED screen.
Device
  isSimulator : Boolean
[read-only] Returns true if the application is running in the simulator.
Device
  os : String
[read-only] Returns the OS of the device.
Device
  pin : String
[read-only] Returns the PIN of the device.
Device
  scmBundle : String
[read-only] Returns the SCM Bundle of the device.
Device
  screenDiagonal : Number
[read-only] Returns the screen diagonal of the device in inches.
Device
  screenHeight : Number
[read-only] Returns the screen height of the device in inches.
Device
  screenWidth : Number
[read-only] Returns the screen width of the device in inches.
Device
  serialNumber : String
[read-only] Returns the serial number of the device.
Device
  vendorID : uint
[read-only] Returns the Vendor ID of the device.
Device

Public Methods

 MethodDefined By
  
Device(enforcer:SingletonEnforcer)
Do not use the constructor to instanitate a instance of this class.
Device
  
toString():String
[override] Returns a String containing device, software, and hardware information.
Device

Events

 Event Summary Defined By
   Dispatched when a battery level change occurs.Device
   Dispatched when a battery state change occurs.Device

Property Detail

batteryLevel


batteryLevel:int  [read-only]

Returns the battery level of the device.

If the batteryMonitoringEnabled property is set to true, a value between 0 and 100 will be returned indicating the battery level. If the batteryMonitoringEnabled property is set to false, -1 is returned indicating that the battery level is unknown.

The default value is -1.


Implementation

public function get batteryLevel():int

See also

batteryMonitoringEnabled

batteryMonitoringEnabled


batteryMonitoringEnabled:Boolean

Turns battery monitoring on or off.

When set to true, DeviceBatteryEvent.LEVEL_CHANGE and DeviceBatteryEvent.STATE_CHANGE events will be dispatched whenever changes to the battery level and state occur. When set to false, events will not be fired.

The default value is false.


Implementation

public function get batteryMonitoringEnabled():Boolean
public function set batteryMonitoringEnabled(value:Boolean):void

See also

DeviceBatteryState

batteryState


batteryState:int  [read-only]

Returns the battery state of the device.

If the batteryMonitoringEnabled property is set to false, DeviceBatteryState.UNKNOWN is returned as the state is unknown. If the batteryMonitoringEnabled property is set to true, the battery state will be returned.

The following are valid values:

  • DeviceBatteryState.UNKNOWN
  • DeviceBatteryState.FULL
  • DeviceBatteryState.CHARGING
  • DeviceBatteryState.UNPLUGGED

The default value is DeviceBatteryState.UNKNOWN.


Implementation

public function get batteryState():int

See also

DeviceBatteryState
batteryMonitoringEnabled

device


device:Device  [read-only]

Gets a Singleton Device instance.


Implementation

public static function get device():Device

hardwareID


hardwareID:int  [read-only]

Returns the Hardware ID of the device.


Implementation

public function get hardwareID():int

isOLED


isOLED:Boolean  [read-only]

Returns true if the device the application is running on has an OLED screen. If this value is true you may want to use different visual assets that are darker, as battery life on OLED devices is affected more by the brightness of the screen than other screen types.

Note that if you are testing on the desktop the value returned will always be false.


Implementation

public function get isOLED():Boolean

isSimulator


isSimulator:Boolean  [read-only]

Returns true if the application is running in the simulator.


Implementation

public function get isSimulator():Boolean

os


os:String  [read-only]

Returns the OS of the device.


Implementation

public function get os():String

pin


pin:String  [read-only]

Returns the PIN of the device.

In order to access this property, you must set the read_device_identifying_information permission attribute for your application. See the BlackBerry Tablet OS Developer's Guide for more information.


Implementation

public function get pin():String

scmBundle


scmBundle:String  [read-only]

Returns the SCM Bundle of the device.


Implementation

public function get scmBundle():String

screenDiagonal


screenDiagonal:Number  [read-only]

Returns the screen diagonal of the device in inches. This property is NaN when run on the desktop.


Implementation

public function get screenDiagonal():Number

screenHeight


screenHeight:Number  [read-only]

Returns the screen height of the device in inches. This property is NaN when run on the desktop.


Implementation

public function get screenHeight():Number

screenWidth


screenWidth:Number  [read-only]

Returns the screen width of the device in inches. This property is NaN when run on the desktop.


Implementation

public function get screenWidth():Number

serialNumber


serialNumber:String  [read-only]

Returns the serial number of the device.

In order to access this property, you must set the read_device_identifying_information permission attribute for your application. See the BlackBerry Tablet OS Developer's Guide for more information.


Implementation

public function get serialNumber():String

vendorID


vendorID:uint  [read-only]

Returns the Vendor ID of the device.


Implementation

public function get vendorID():uint

Constructor Detail

Device()


public function Device(enforcer:SingletonEnforcer)

Do not use the constructor to instanitate a instance of this class. Use the Device.device method to return the Singleton instance of the class.

Parameters

enforcer:SingletonEnforcer — Used to prevent calling the constructor directly.

See also

device

Method Detail

toString()


override public function toString():String

Returns a String containing device, software, and hardware information.

Returns

String — A String containing device information.

Event Detail

BatteryLevelChange


Event Object Type: qnx.events.DeviceBatteryEvent
DeviceBatteryEvent.type property = qnx.events.DeviceBatteryEvent.LEVEL_CHANGE

Dispatched when a battery level change occurs.

The DeviceBatteryEvent.LEVEL_CHANGE constant defines the value of the type property of the event object for an BatteryLevelChange event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe object that is actively processing the Event object with an event listener.
batteryLevelThe battery level at the time of the event.
batteryStateThe state of the battery at the time of the event.
typeDeviceBatteryEvent.LEVEL_CHANGE

See also

batteryLevel

BatteryStateChange


Event Object Type: qnx.events.DeviceBatteryEvent
DeviceBatteryEvent.type property = qnx.events.DeviceBatteryEvent.STATE_CHANGE

Dispatched when a battery state change occurs.

The DeviceBatteryEvent.STATE_CHANGE constant defines the value of the type property of the event object for an BatteryStateChange event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe object that is actively processing the Event object with an event listener.
batteryLevelThe battery level at the time of the event.
batteryStateThe state of the battery at the time of the event.
typeDeviceBatteryEvent.STATE_CHANGE

See also

DeviceBatteryState
batteryState





comments powered by Disqus