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
ahsan_iqbal
Posts: 26
Registered: ‎04-11-2012
My Device: BlackBerry Play book

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
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

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
ahsan_iqbal
Posts: 26
Registered: ‎04-11-2012
My Device: BlackBerry Play book

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
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

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.