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

Java Development

Reply
Developer
developer_aman_arora
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
Accepted Solution

What is keycode to lock Blackberry device 9300 curve?

i want to programmatically lock  handset, i am able to do it in other handsets, but unable to lock in 9300 curve,

 

because in 9300 curve it will be done by long pressing mute key, so may i know key code for mute key for this

 

handset?

 

Thanks & Regards

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: What is keycode to lock Blackberry device 9300 curve?

[ Edited ]

ApplicationManager.lockSystem(); ?

Developer
developer_aman_arora
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10

Re: What is keycode to lock Blackberry device 9300 curve?

i want to lock device by key press...
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: What is keycode to lock Blackberry device 9300 curve?

[ Edited ]

Sorry you said "i want to programmatically lock  handset,"  So I assumed you were a BlackBerry Java application developer.  Is that the case?

 

When your device is in the foreground and displaying on the screen - then you can detect whatever key you want and issue the lock. 

 

If you are trying to do this with your app in the background, good luck.  Search the forum for people who have tried to detect key presses when their application was running in the background.  Beside that, why would the user press some special key you use, when they can just lock the device themselves.

 

I guess I am not understanding what you are trying to do here.  Perhaps you could explain what the user will do when they are using your application. 

 

 

 

Developer
developer_aman_arora
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10

Re: What is keycode to lock Blackberry device 9300 curve?

273 is keycode
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: What is keycode to lock Blackberry device 9300 curve?

[ Edited ]

Have you resolved your own problem then?  If so, that is great, but can you mark it as solved?  Instructions in the Help link near the top of the screen.

 

Just has a thought - perhaps you are trying to inject this code using key injection?

Developer
developer_aman_arora
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10

Re: What is keycode to lock Blackberry device 9300 curve?

yes i have done it using below code

if(Keypad.key(keycode) == Keypad.KEY_LOCK || Keypad.key(keycode) == 273)
{
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
Dialog dialog = new Dialog(Dialog.D_OK, "Lock Key Press", 0, null, Dialog.FIELD_HCENTER);
Ui.getUiEngine().pushGlobalScreen(dialog, 1, UiEngine.GLOBAL_MODAL );
}
});
return true;
}