net.rim.device.api.system
Class DeviceInfo

java.lang.Object
  extended by net.rim.device.api.system.DeviceInfo

public final class DeviceInfo
extends Object

This class provides access to fundamental information about the host device.

The DeviceInfo class provides access to information on the handheld.


Field Summary
static int BSTAT_AC_CONTACTS
          Battery is charging via the AC contacts.
static int BSTAT_CHARGING
          Battery is charging.
static int BSTAT_DEAD
          Battery at or below zero percent.
static int BSTAT_IS_USING_EXTERNAL_POWER
          Device is connected to an external power source.
static int BSTAT_LEVEL_CHANGED
          The level of the battery has changed, call getBatteryLevel() for detailed info on the Battery Level
static int BSTAT_LOW
          Battery is low.
static int BSTAT_LOW_RATE_CHARGING
          Battery is charging, but at a reduced rate.
static int BSTAT_NONE
          No battery.
static int BSTAT_NO_CAMERA_FLASH
          Battery is too low for camera flash usage.
static int BSTAT_NO_RADIO
          Battery is too low for radio usage.
static int BSTAT_NO_TURN_ON
          Battery is too low for device to turn on.
static int BSTAT_NO_WLAN
          Battery is too low for WLAN radio usage.
static int BSTAT_REVERSED
          Battery is inserted backwards.
static int BSTAT_TOO_COLD
          Battery is too cold.
static int BSTAT_TOO_HOT
          Battery is too hot.
static int BSTAT_UNKNOWN_BATTERY
          Battery is not recognized by the firmware.
static int INVALID_DEVICE_ID
          Devices with no provisioned PIN (for example, BB-Built-In) shall return the following constant.
 
Method Summary
static boolean canResetIdleTime()
          Checks whether or not the calling application can reset the device's idle timer.
static int getBatteryLevel()
          Retrieves the current battery level.
static int getBatteryStatus()
          Retrieves the battery status.
static int getBatteryTemperature()
          Retrieves battery's current temperature.
static int getBatteryVoltage()
          Retrieves battery's current voltage.
static int getDeviceId()
          Retrieves the PIN number for this device.
static String getDeviceName()
          Retrieves the current device's product name.
static long getIdleTime()
          Retrieves the number of seconds since the last key or thumbwheel event.
static int getLockTimeout()
          Retrieves the device's lock timeout value in seconds.
static String getManufacturerName()
          Retrieve the device manufacturer's name.
static int getOSVersion()
          Deprecated. This function attempts to pack the String returned by DeviceInfo.getPlatformVersion() into the format specified above. If it is unsuccessful, it will return 0. Please use DeviceInfo.getPlatformVersion() instead.
static String getPlatformVersion()
          Retrieves the platform version.
static String getSoftwareVersion()
          Retrieves the device's software version.
static int getTotalFlashSize()
          Deprecated. this method is limited to 2GB, use DeviceInfo.getTotalFlashSizeEx() instead
static long getTotalFlashSizeEx()
          Retrieves the total flash size of the device.
static boolean hasCamera()
          Determines if this device has a camera
static boolean isBatteryRemovable()
          Determines if this device has a removable battery.
static boolean isInHolster()
          Deprecated. See Sensor.HOLSTER
static boolean isPasswordEnabled()
          Check if the password is currently enabled on the device.
static boolean isSimulator()
          Determines if this device is really a simulator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

BSTAT_DEAD

public static final int BSTAT_DEAD
Battery at or below zero percent.

See Also:
Constant Field Values

BSTAT_TOO_COLD

public static final int BSTAT_TOO_COLD
Battery is too cold.

See Also:
Constant Field Values

BSTAT_TOO_HOT

public static final int BSTAT_TOO_HOT
Battery is too hot.

See Also:
Constant Field Values

BSTAT_LOW

public static final int BSTAT_LOW
Battery is low.

See Also:
Constant Field Values

BSTAT_NONE

public static final int BSTAT_NONE
No battery.

See Also:
Constant Field Values

BSTAT_REVERSED

public static final int BSTAT_REVERSED
Battery is inserted backwards.

See Also:
Constant Field Values

BSTAT_UNKNOWN_BATTERY

public static final int BSTAT_UNKNOWN_BATTERY
Battery is not recognized by the firmware.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

BSTAT_NO_TURN_ON

public static final int BSTAT_NO_TURN_ON
Battery is too low for device to turn on.

See Also:
Constant Field Values

BSTAT_NO_RADIO

public static final int BSTAT_NO_RADIO
Battery is too low for radio usage.

See Also:
Constant Field Values

BSTAT_NO_CAMERA_FLASH

public static final int BSTAT_NO_CAMERA_FLASH
Battery is too low for camera flash usage.

See Also:
Constant Field Values
Since:
BlackBerry API 4.2.0

BSTAT_CHARGING

public static final int BSTAT_CHARGING
Battery is charging.

See Also:
Constant Field Values

BSTAT_LOW_RATE_CHARGING

public static final int BSTAT_LOW_RATE_CHARGING
Battery is charging, but at a reduced rate. Typically this indicates that the device is connected to a PC that doesn't have the RIM USB driver installed.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

BSTAT_IS_USING_EXTERNAL_POWER

public static final int BSTAT_IS_USING_EXTERNAL_POWER
Device is connected to an external power source.

See Also:
Constant Field Values
Since:
BlackBerry API 3.6.0

BSTAT_LEVEL_CHANGED

public static final int BSTAT_LEVEL_CHANGED
The level of the battery has changed, call getBatteryLevel() for detailed info on the Battery Level

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

BSTAT_NO_WLAN

public static final int BSTAT_NO_WLAN
Battery is too low for WLAN radio usage.

See Also:
Constant Field Values
Since:
BlackBerry API 4.2.1

BSTAT_AC_CONTACTS

public static final int BSTAT_AC_CONTACTS
Battery is charging via the AC contacts.

See Also:
Constant Field Values
Since:
BlackBerry API 4.2.1

INVALID_DEVICE_ID

public static final int INVALID_DEVICE_ID
Devices with no provisioned PIN (for example, BB-Built-In) shall return the following constant.

See Also:
Constant Field Values
Since:
BlackBerry API 4.2.0


Method Detail

getDeviceId

public static int getDeviceId()
Retrieves the PIN number for this device.

This method will return the PIN number of a device or the default value of 0x2100000a if connected to the simulator. You can modify the default value associated with the simulator by using the PIN command line option.

The PIN command line option takes the form of: /PIN=<PIN> where PIN is the integer value to be associated with the simulator.

Returns:
Unique ID (PIN) for this device.

getBatteryLevel

public static int getBatteryLevel()
Retrieves the current battery level.

Returns:
Percentage of maximum battery level remaining.

getBatteryStatus

public static int getBatteryStatus()
Retrieves the battery status.

Returns:
Combination of the BSTAT_xxx masks from this class.

isBatteryRemovable

public static boolean isBatteryRemovable()
Determines if this device has a removable battery.

Returns:
True if this device has removable battery.

getOSVersion

public static int getOSVersion()
Deprecated. This function attempts to pack the String returned by DeviceInfo.getPlatformVersion() into the format specified above. If it is unsuccessful, it will return 0. Please use DeviceInfo.getPlatformVersion() instead.

Retrieves the OS version.

Returns:
OS version in a 4 byte packet. You should interpret this value on a per-byte basis. Thus, read the returned integer 33557790 as 0x02 00 0D 1E in hex, which is 2.0.13.30 in decimal.

getPlatformVersion

public static String getPlatformVersion()
Retrieves the platform version.

Returns:
A string representing the platform version. An empty string may be returned when program is being run on a simulator.
Since:
BlackBerry API 4.0.0

getSoftwareVersion

public static String getSoftwareVersion()
Retrieves the device's software version.

Returns:
A string representing the device's software version, or an empty string if the software version could not be retrieved.
Since:
BlackBerry API 4.3.0

isInHolster

public static boolean isInHolster()
Deprecated. See Sensor.HOLSTER

Determines if the device is in the holster or if the flip is closed (for flip phones).

Returns:
True if this device is in the holster or flipped close (for flip phones); otherwise, false.

getTotalFlashSize

public static int getTotalFlashSize()
Deprecated. this method is limited to 2GB, use DeviceInfo.getTotalFlashSizeEx() instead

Retrieves the total flash size of the device.

Note that this method returns an integer value that is limited to 2GB. If a BlackBerry handheld has more than 2GB of flash memory then use DeviceInfo.getTotalFlashSizeEx() method to get long value.

Returns:
flash size in bytes, limited to 2GB
Since:
BlackBerry API 4.5.0

getTotalFlashSizeEx

public static long getTotalFlashSizeEx()
Retrieves the total flash size of the device.

Returns:
flash size in bytes
Since:
BlackBerry API 6.0.0

getIdleTime

public static long getIdleTime()
Retrieves the number of seconds since the last key or thumbwheel event.

Returns:
Seconds since last key or thumbwheel event.

isSimulator

public static boolean isSimulator()
Determines if this device is really a simulator.

Returns:
True if the code is running in the simulator; otherwise, false.
Since:
BlackBerry API 4.0.0

getDeviceName

public static String getDeviceName()
Retrieves the current device's product name.

This method retrieves the current device's product name, with an optional one-letter suffix to distinguish the radio type. For example, GPRS 7130 devices return "7130", while CDMA 7130 devices return "7130e" and UMTS 7130 devices return "7130u".

Returns:
The current device's product name.
Since:
BlackBerry API 4.0.0

getBatteryVoltage

public static int getBatteryVoltage()
Retrieves battery's current voltage.

Returns:
Current voltage (milliVolts) provided by battery.
Since:
BlackBerry API 4.0.0

getBatteryTemperature

public static int getBatteryTemperature()
Retrieves battery's current temperature.

Returns:
Approximate temperature (celsius) of battery.
Since:
BlackBerry API 4.0.0

isPasswordEnabled

public static boolean isPasswordEnabled()
Check if the password is currently enabled on the device.

Since:
BlackBerry API 4.1.0

getManufacturerName

public static String getManufacturerName()
Retrieve the device manufacturer's name.

Returns:
The device manufacturer's name, or null if the name is not available.
Since:
BlackBerry API 4.1.0

hasCamera

public static boolean hasCamera()
Determines if this device has a camera

Returns:
True if this device has a camera
Since:
BlackBerry API 4.2.0

canResetIdleTime

public static boolean canResetIdleTime()
Checks whether or not the calling application can reset the device's idle timer.

All of the following conditions must be satisfied in order for an application to be able to reset the device's idle timer:

Returns:
true if the calling application can reset the device's idle timer; false otherwise
Since:
BlackBerry API 4.3.0

getLockTimeout

public static int getLockTimeout()
Retrieves the device's lock timeout value in seconds.

Returns:
The device's lock timeout value in seconds.
Since:
BlackBerry API 4.3.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal