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
Posts: 436
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Unable to lock device programmatically

I am looking for a code to lock the blackberry keypad programmatically.I have found the code to turn off the device but not to lock it.Here is the code

 

public static final void powerCycle (int delayToPowerOn) {
    int timeDelay = 1000 * delayToPowerOn;
    ApplicationManager myMgr = ApplicationManager.getApplicationManager();
    ApplicationDescriptor myDsc = ApplicationDescriptor.currentApplicationDescriptor(); 

    // myMgr.setCurrentPowerOnBehavior(myDsc.POWER_ON);

    Date myDate = new Date();

    myMgr.scheduleApplication(myDsc, myDate.getTime()+timeDelay, true);
    net.rim.device.api.system.Device.requestPowerOff( true); 

}

 Can anyone help me with locking of device programmatically.Will be highly grateful

Developer
Posts: 436
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: Unable to lock device programmatically

Upto 4.7 OS this block of code is working fine

 



ApplicationManager manager = ApplicationManager.getApplicationManager();
        manager.lockSystem(true);

 But from 5.0 i think its deprecated.So any turn around for this?