Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12509] TiAPI: Power management - Keep Screen On

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2018-09-07T01:22:12.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTiAPI
Labelsn/a
ReporterJosh Roesslein
AssigneeUnknown
Created2013-01-31T04:59:22.000+0000
Updated2018-09-10T18:33:08.000+0000

Description

Developers may sometimes require the ability to prevent a device from powering off its display and/or CPU during certain periods of time while their application performs some task. Most of our native platforms provide an API for these use cases. Android for example has WakeLock which provides various levels which affect the device's power management. You may also set a flag at the View which will keep the screen on (we already expose this in Titanium). BlackBerry provides an "idle mode" flag on the main window which has two modes: Normal and KeepAwake. The goal of this ticket is to come up with some common API that we may expose to our developers which is suitable for the various platform which are capable of this feature.

Comments

  1. Joshua Quick 2018-09-07

    Wake lock support was added to local notifications. See: [TIMOB-24629] So, if you want device screen to stay on while the app is backgrounded, a local notification with wake lock enabled is needed. This is more in-line with how Google wants it to work in this particular case, because like foreground services, they want apps to notify the end-user that the app is doing something in the background that requires the screen to stay on. Closing.
  2. kosso 2018-09-10

    I use Ti.App.idleTimerDisabled([true | false]) to keep iOS screens on. https://docs.appcelerator.com/platform/latest/#!/api/Titanium.App-property-idleTimerDisabled
  3. Joshua Quick 2018-09-10

    We also have a Window.keepScreenOn and View.keepScreenOn for Android... https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Window-property-keepScreenOn https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.View-property-keepScreenOn But these properties, including iOS' idleTimerDisabled, are only in effect while the app is in the foreground. The whole point of this ticket is to keep the screen on while the app is in the background. That's the only relevant reason to use a wake-lock. Although, in my opinion, you should avoid it on Android when possible since the wake-lock permission is a dirty word. I've seen apps get bad reviews on Google Play simply for stating that it uses the WAKE_LOCK permission, because a lot of end-users blame poor battery life on it.

JSON Source