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

Android™ Runtime Development

Reply
Regular Contributor
Fraggle222
Posts: 84
Registered: ‎01-31-2013
My Device: Simulator !!!

How to distinguish between power button click(screen lock/off) and minimize/exit app?

On blackberry z10 device, clicking the power button to turn off the screen behaves the same way as when the user minimizes the app (swipe up from bottom).

 

This is unlike any other android device/runtime out there today.

 

On BB10 the following is called for both a powerbutton click and for a minimize gesture:

onUserLeaveHint

onPause

onStop

 

Note that in all other Android devices, just onPause will be called if user clicks the power button.

 

Does anyone know of a way to detect if the app is minimized vs, just having the screen off?

Regular Contributor
Fraggle222
Posts: 84
Registered: ‎01-31-2013
My Device: Simulator !!!

Re: How to distinguish between power button click(screen lock/off) and minimize/exit app?

I've discovered that the method calls behave differently depending on whether the Activity is holding a PowerManager.WakeLock as mine was. Still onStop is getting called which is werid. Anyway I will update this thread and JIRA issue soon with more details.