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

Web and WebWorks Development

Posts: 35
Registered: ‎07-07-2011
My Device: Torch
My Carrier: AT&T

Screen lock and onHardwareKey

I'm seeing a behavior which I think should be handled by the WebWorks framework rather then by each application. My application (OS 6,7) is registering a listener for a hardware button (menu, back, etc.) via blackberry.system.event.onHardwareKey. The issue I'm seeing happens when the screen locks. If the user presses a physical button when the screen is locked my button listener gets notified and the screen wakes up with a toast that informs the user to unlock the device.


I feel like the button listener should not get notified of a button press if the button press occurred while the screen was locked. Seems to me the framework should be managing this and only notifying the application of button presses when the screen is not locked.


Here's some simple code to exhibit the issue:


<!DOCTYPE html>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
      <title>Button Event Bug</title>
      <li>Lock the screen.</li>
      <li>Press the menu button.</li>
      <li>Screen will wake up and menu button alert message will display
      beneath the screen unlock toast message.</li>
    <script type="text/javascript">
      var alertEvent = function(event) {
        alert('menu button detected');
          blackberry.system.event.KEY_MENU, alertEvent);