Display

The Display object contains functions for determining whether the screen dims while the app is in the foreground.

Since: BlackBerry WebWorks 2.1

Use this API only when necessary in your app because it can reduce battery life.

If a user minimizes your app or moves it to the background, the API can't stop the display from going to sleep.

Installation:

To use this API in your project, add the display plugin:

webworks plugin add com.blackberry.display

getPreventSleepStatus()

Returns true if sleep is prevented.

Synopsis:

void blackberry.display.getPreventSleepStatus(onSuccess, onError)

Parameters:

onSuccess {Function}

Callback function that is invoked when status is successfully retrieved.

returnValue {Boolean}

True when screen will stay on; otherwise, normal timeout will occur.

onError {Function}

Callback function that is invoked if there was a problem retrieving the status.

setPreventSleep()

Set to true to prevent sleep.

Synopsis:

void blackberry.display.setPreventSleep(option, onSuccess, onError)

Parameters:

option {Boolean}

True when screen will stay on; otherwise normal timeout will occur.

onSuccess {Function}

Callback function that is invoked when status is successfully set.

onError {Function}

Callback function that is invoked if there is a problem setting the status.

Last modified: 2014-05-23



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus