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

Native Development

Reply
New Developer
Posts: 26
Registered: ‎04-11-2012
My Device: BlackBerry Play book
My Carrier: BlackBerry

how to capture the event of pressing power button of device

Hi

 

I have searched a lot on google but unable to find any solution that I can identify in my application that user did press the power button

Can any body guide me about this

Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: how to capture the event of pressing power button of device

I don't think it is an event. What purpose do you want to use the event for?
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
New Developer
Posts: 26
Registered: ‎04-11-2012
My Device: BlackBerry Play book
My Carrier: BlackBerry

Re: how to capture the event of pressing power button of device

Hi

 

I am working on a game, and I need to identify when user pressed the power button so that I can pause/unpause the game and mute/unmute sound effects, I guess it is an event at least other platforms like iphone and android, if it is not an event in blackberry is there any way I could identify this struff.

 

Regards

Ahsan

BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: how to capture the event of pressing power button of device

There are bps/navigator events which indicate when your app is in the foreground or not.  You should watch for these instead of explicitly trying to determine if someone has pressed a hard button.