Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
ytpete
Posts: 30
Registered: ‎01-09-2011
My Device: PlayBook

Keep screen / backlight on?

Does anyone know if there's an API to prevent the screen from "going to sleep"?  (Or will there be such an API by the time the device ships?)

 

This is important for media players, conferencing apps, certain types of dashboard apps, etc.  Other platforms like Android provide an API for this, but I haven't been able to find one in the Tablet SDK.

 

Thanks in advance to anyone who can help!

 

- Peter

Please use plain text.
Developer
zezke
Posts: 1,004
Registered: ‎12-12-2010
My Device: Z10 (red Limited Edition)
My Carrier: Mobile Vikings

Re: Keep screen / backlight on?

This API is not (yet) available.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
New Developer
ElectricGrandpa
Posts: 19
Registered: ‎01-25-2011
My Device: Not Specified

Re: Keep screen / backlight on?

I'm also looking for the same thing. 

 

Would it be possible to simulate a touch event every 30 seconds, or something like that, in order to "trick" the Playbook into staying awake? 

 

 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Keep screen / backlight on?

 


ElectricGrandpa wrote:
Would it be possible to simulate a touch event every 30 seconds, or something like that, in order to "trick" the Playbook into staying awake? 

No.  And why would you want to do that?  There will be such an API... it's just not available yet.  By the time you have a PlayBook that would actually go to sleep, you'll also have the API to keep it awake.

 


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
TheDarkIn1978
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Keep screen / backlight on?

[ Edited ]

flash.desktop.NativeApplication.systemIdleMode:


 

Provides a way for applications to prevent the user interface from going into "idle" mode.


A value from the SystemIdleMode class to influence the host system's idle mode behavior. This property is only effective for the application with input focus and can only be accessed from content running in the application sandbox.


AIR profile support: This feature is supported on mobile devices, but it is not supported on desktop operating systems or AIR for TV devices. See AIR Profile Support for more information regarding API support across multiple profiles.

 


 

however, for development on Android OS, the following permissions need to be set in addition to systemIdleMode:

 

 <android>
      <manifestAdditions>
         <![CDATA[
            <manifest>
              <uses-permission android:name="android.permission.WAKE_LOCK" />
              <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
            </manifest>
          ]]>
     </manifestAdditions>
   </android>

certainly, permissions will also need to be set for PlayBook, especially since Application Control Permissions were introduced with the latest SDK, but i can't find a list of all available <permission> tags for PlayBook's application discriptor .xml file (ex:  <permission>use_camera</permission>).  if there is such a list, i'd check there for similar permission tags and set them in the discriptor file.  otherwise, this just isn't available yet.


PlayBook Applications:
Drop Swatch
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Keep screen / backlight on?

Is that systemIdleMode stuff documented anywhere as being what will be used on the PlayBook?

 

Also, what does it do when your app is not in the foreground (full-screen)?

 

Is there another API that will be used to keep the device from going to the low-power state (what I'd actually call "asleep") even when an app is not in the foreground?  For example, what does an app that wants to play music do to prevent the device from sleeping even when it's not the visible app?

 

I figured the systemIdleMode thing was limited enough it made sense to wait to see what QNX-specific API is provided to handle all this, and to see how/whether the systemIdleMode setting factors into things.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
New Developer
ElectricGrandpa
Posts: 19
Registered: ‎01-25-2011
My Device: Not Specified

Re: Keep screen / backlight on?

I see no problem with at least seeing if it's possible. If it works, then it works, no harm done. I'd rather submit the app sooner rather than wait around until the API is eventually made available. 

Please use plain text.
Developer
TheDarkIn1978
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Keep screen / backlight on?

[ Edited ]

sure, it would certainly make more sense for RIM to add a systemIdelMode property to their own QNXApplication API.

 


ElectricGrandpa wrote:

I see no problem with at least seeing if it's possible. If it works, then it works, no harm done. I'd rather submit the app sooner rather than wait around until the API is eventually made available. 


 

you'll still have to find the application control permission tags for this, and it doesn't seem like any are currently available.  i would be very surprised if the following worked:

 

 

<permission>wake_lock</permission>
<permission>disable_keyguard</permission>

 

 


PlayBook Applications:
Drop Swatch
Please use plain text.
BlackBerry Development Advisor (Retired)
rmassand
Posts: 7
Registered: ‎04-26-2010
My Device: 9800
My Carrier: Rogers

Re: Keep screen / backlight on?

In order to keep the backlight on when your application is in the foreground, you can add the following line in the AIR application's initialization logic - 

NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;

Please use plain text.
Developer
TheDarkIn1978
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Keep screen / backlight on?

good to know.  thanks for the confirmation.  i suppose also since you didn't mention otherwise this means that, unlike Android, no permission tags are required?


PlayBook Applications:
Drop Swatch
Please use plain text.