Device

From Pointui

This is a Global object. You must not create an instance of it as one is always available for your use.

Provides access to some device specific settings. NOTE: this is a global object so an instance is always available to use – you do not need to ever create additional instances.

Contents

Methods

bool IsLandscape()

Returns true if the screen is currently landscape. This does not imply native orientation, or perceived orientation. It will return true if the width of the screen as it is currently displayed is wider than the height.

bool IsVGA()

Returns true if the device is VGA or WVGA.

bool IsSquareScreen()

AVAILABLE SINCE: 2.0.18b Returns true if the device has a square screen such as 320x320 pixels.

int GetOrientation()

AVAILABLE SINCE: 2.0.20b Returns the current orientation of the screen, and is one of the following values:

  • -1: Unknown
  • 0: Normal orientation
  • 90: Rotated 90 degrees
  • 180: Rotated 180 degrees
  • 270: Rotated 270 degrees

void SetOrientation(int orientationDegrees)

AVAILABLE SINCE: 2.0.20b Sets the orientation of the device. The orientationDegrees parameter must be one of the following values:

  • 0: Normal orientation
  • 90: Rotated 90 degrees
  • 180: Rotated 180 degrees
  • 270: Rotated 270 degrees

int AutoScaleValue(int value)

Provides a way to automatically scale constants to account for differences between VGA and QVGA.

PARAMETERS

  • value – value to be automatically scaled if necessary.

RETURN VALUE

If the device is QVGA then the value supplied is returned without change. If the device is VGA then the value returned is (value * 2). AutoScaleValue is used for keeping consistent layout code between QVGA and VGA builds. Often you need to use constants for positioning controls on the screen such as padding. It is recommended that even if you are developing for VGA, use values that are applicable to QVGA and call AutoScaleValue. Values passed in to AutoScaleValue are always for the lowest resolution (QVGA) because it is guaranteed that they will upscale proportionally correctly which doesn’t occur in reverse because values would need to snap to the nearest pixel if not divisible by 2.

EXAMPLE

int padding;
//want 6 pixels padding in VGA
padding = Device.AutoScaleValue(3);

void SetBacklightBrightness(int brightnessBattery, int brightnessAC)

AVAILABLE SINCE: 2.1 Sets the backlight brightness level. Both brightnessBattery and brightnessAC must be a value between 0 and 10 (maximum brightness).

String GetDeviceID()

Returns the unique device id for the device.

int GetSpeakerVolume()

Returns the speaker volume which is a value between 0 (mute) and 100 (maximum).

void SetSpeakerVolume(int volume)

Sets the speaker volume. The volume parameter must be a value between 0 (mute) and 100 (maximum).

void SetSpeakerVolume(int volumeLeft, int volumeRight)

Sets the left and right speaker volumes independently. The volume parameters must be between 0 (mute) and 100 (maximum).

int GetRingerVolume()

Returns the ringer volume which is a value between 0 (mute) and 100 (maximum).

void SetRingerVolume(int volume)

Sets the ringer volume. The volume parameter must be a value between 0 (mute) and 100 (maximum).

void GetMemoryUsage(int totalPhysical, int availablePhysical)

Gets the memory usage values and returns them in the parameter variables provided.

void GetDiskUsage(int total, int available)

Gets the disk usage values and returns them in the parameter variables provided.

String GetOEMString()

Returns the OEM string for the device.

int GetScreenWidth()

Returns the width of the screen in pixels.

int GetScreenHeight()

Returns the height of the screen in pixels.

void Lock()

Locks the device using the native locking functionality. While locked, the user cannot accidentally press the screen or buttons. To use the device properly again, the user will have to follow the instructions on screen to unlock the device which can vary between manufacturers.

bool GetIsDeviceLocked()

AVAILABLE SINCE: 2.0.22b Returns true if the device is currently locked.

uint GetTickCount()

Returns the number of milliseconds since the device was last booted.

void HapticFeedback()

* NOT AVAILABLE IN FREE VERSION OF HOME

Performs a burst of haptic feedback. The user must have haptic feedback enabled in their settings for this to work.

String GetPrimaryLanguage()

Returns the primary language for the device and is one of the following values:

  • AFRIKAANS
  • ALBANIAN
  • ARABIC
  • ARMENIAN
  • ASSAMESE
  • AZERI
  • BASQUE
  • BELARUSIAN
  • BENGALI
  • BULGARIAN
  • CATALAN
  • CHINESE
  • CROATIAN
  • CZECH
  • DANISH
  • DIVEHI
  • DUTCH
  • ENGLISH
  • ESTONIAN
  • FAEROESE
  • FARSI
  • FINNISH
  • FRENCH
  • GEORGIAN
  • GERMAN
  • GREEK
  • GUJARATI
  • HEBREW
  • HINDI
  • HUNGARIAN
  • ICELANDIC
  • INDONESIAN
  • ITALIAN
  • JAPANESE
  • KANNADA
  • KASHMIRI
  • KAZAK
  • KONKANI
  • KOREAN
  • LATVIAN
  • LITHUANIAN
  • MACEDONIAN
  • MALAY
  • MALAYALAM
  • MANIPURI
  • MARATHI
  • MONGOLIAN
  • NEPALI
  • NORWEGIAN
  • ORIYA
  • POLISH
  • PORTUGUESE
  • PUNJABI
  • ROMANIAN
  • RUSSIAN
  • SANSKRIT
  • SERBIAN
  • SINDHI
  • SLOVAK
  • SLOVENIAN
  • SPANISH
  • SWAHILI
  • SWEDISH
  • SYRIAC
  • TAMIL
  • TATAR
  • TELUGU
  • THAI
  • TURKISH
  • UKRAINIAN
  • URDU
  • UZBEK
  • VIETNAMESE

void DebugWrite(String message)

Writes text to the output window when using the Sandbox build. This should only be used while developing and should not be included in applets that are provided to the general public.