how to implement device lock?? | developer.brewmp.com how to implement device lock?? | developer.brewmp.com

Developer

how to implement device lock??

Forums:

Hi all,

 

 

Is there any api or any way to lock and unlock the device???

 

-Hnau

Do you mean locking the device screen/keypad?

Do you mean locking the device screen/keypad?

screen lock and if possbile provide solution for keypad lock also

screen lock and if possbile provide solution for keypad lock also

There are no APIs for this. You can design your own UI for screen lock. Brew provides notifications on screen lock (EVT_KEYGUARD). To lock keypad, consume all the key events in your app and show lock UI. To unlock provide instructions (like press #), change the UI and let app pass the key events to Brew.

There are no APIs for this. You can design your own UI for screen lock. Brew provides notifications on screen lock (EVT_KEYGUARD). To lock keypad, consume all the key events in your app and show lock UI. To unlock provide instructions (like press #), change the UI and let app pass the key events to Brew.

Hi,
 1. Please guide some steps or some example code for how to implement our own UI for screen lock and to unlock.
 
2. Is this correct implementation for getting notification for idle and nonidle mode for HTC Freestyle
nErr= ISHELL_RegisterNotify(pMe->piShell, AEECLSID_CTESTAPP, AEECLSID_NATIVENOTIFIER, NMASK_NATIVENOTIFIER_ALL);
if( AEE_SUCCESS != nErr)
{
 DBGPRINTF("FAILED TO REGISTER NOTIFICATION\n");
 return;
}
boolean testapp_HandleEventcase EVT_NOTIFY:
 
  if ((pNotify->cls == AEECLSID_NATIVENOTIFIER) && (pNotify->dwMask == NMASK_NATIVENOTIFIER_IDLE ))

 {

 DBGPRINTF_HIGH("IDLE NOTIFICATION RECEIVED\n" );

 return TRUE;
 if((pNotify->cls == AEECLSID_NATIVENOTIFIER) && (pNotify->dwMask == NMASK_NATIVENOTIFIER_NONIDLE ))}

{

DBGPRINTF_HIGH("NONIDLE NOTIFICATION RECEIVED\n" );
return TRUE;
}

Please Guide us the steps
Waiting for the reply!
Thanks

Pallavi

Hi,
 1. Please guide some steps or some example code for how to implement our own UI for screen lock and to unlock.
 
2. Is this correct implementation for getting notification for idle and nonidle mode for HTC Freestyle
nErr= ISHELL_RegisterNotify(pMe->piShell, AEECLSID_CTESTAPP, AEECLSID_NATIVENOTIFIER, NMASK_NATIVENOTIFIER_ALL);
if( AEE_SUCCESS != nErr)
{
 DBGPRINTF("FAILED TO REGISTER NOTIFICATION\n");
 return;
}
boolean testapp_HandleEventcase EVT_NOTIFY:
 
  if ((pNotify->cls == AEECLSID_NATIVENOTIFIER) && (pNotify->dwMask == NMASK_NATIVENOTIFIER_IDLE ))

 {

 DBGPRINTF_HIGH("IDLE NOTIFICATION RECEIVED\n" );

 return TRUE;
 if((pNotify->cls == AEECLSID_NATIVENOTIFIER) && (pNotify->dwMask == NMASK_NATIVENOTIFIER_NONIDLE ))}

{

DBGPRINTF_HIGH("NONIDLE NOTIFICATION RECEIVED\n" );
return TRUE;
}

Please Guide us the steps
Waiting for the reply!
Thanks

Pallavi

1. UI can be similar to native applications usually show. Please let me know if you need example for anything specific like displaying widgets or text/resources etc. Without OEM help I don't think you can make this because END/SEND keys can be blocked with system privileges only. Also, OEM apps have high priority.
 
2. Ideally it should work. Did you try it on freestyle handset?

1. UI can be similar to native applications usually show. Please let me know if you need example for anything specific like displaying widgets or text/resources etc. Without OEM help I don't think you can make this because END/SEND keys can be blocked with system privileges only. Also, OEM apps have high priority.
 
2. Ideally it should work. Did you try it on freestyle handset?

Thanks for the reply Atul!
I need to implement screen lock/unlock similar to native app. Do we have access to native OEM software(SDK). Can we code using OEM. Is there any OEM sdk needs to be installed.Will be the same process for Brew apps(Passing TBT, Commercializing) if app developed including OEM.
Please explain a correct method how can be acheived screen lock/unlock.
 
For END key to be blocked i read in the forum. If we select the checkbox "Phone" under mif file in "flags" tab.And in HandleEvent code case EVT_KEY
 
 switch(wParam)
{
case AVK_END:
 
case AVK_POWER:
case AVK_STOP:
return TRUE;
} Handling this if pressed END will do nothing in the simulator(END key can be blocked)(tested). However i checked in device as i am not able to launch the app from app manager(case EVT KEY:) key is not capturing from device. Only captures stop event from ct.exe. So needs to be tested once sim is installed in device. Here i am trying to unlock the "simunlock code" for HTC Freestyle device.
simunlock code: We need to provide a code that unlocks the sim.After unlocking only any sim can be used on device.
 
Thanks
Pallavi.

Thanks for the reply Atul!
I need to implement screen lock/unlock similar to native app. Do we have access to native OEM software(SDK). Can we code using OEM. Is there any OEM sdk needs to be installed.Will be the same process for Brew apps(Passing TBT, Commercializing) if app developed including OEM.
Please explain a correct method how can be acheived screen lock/unlock.
 
For END key to be blocked i read in the forum. If we select the checkbox "Phone" under mif file in "flags" tab.And in HandleEvent code case EVT_KEY
 
 switch(wParam)
{
case AVK_END:
 
case AVK_POWER:
case AVK_STOP:
return TRUE;
} Handling this if pressed END will do nothing in the simulator(END key can be blocked)(tested). However i checked in device as i am not able to launch the app from app manager(case EVT KEY:) key is not capturing from device. Only captures stop event from ct.exe. So needs to be tested once sim is installed in device. Here i am trying to unlock the "simunlock code" for HTC Freestyle device.
simunlock code: We need to provide a code that unlocks the sim.After unlocking only any sim can be used on device.
 
Thanks
Pallavi.

By "working with OEM" I mean you need to talk to OEM and work with them. Third party developers don't have access to OEM code/sdk.
Using "Phone" in MIF requires operator/OEM permission.
There is no END key on HTC FreeStyle.

By "working with OEM" I mean you need to talk to OEM and work with them. Third party developers don't have access to OEM code/sdk.
Using "Phone" in MIF requires operator/OEM permission.
There is no END key on HTC FreeStyle.

As above said for idle or nonidle notification i did implement the above code and tested in HTC Freestyle F5151. But notgettings any notifications for the same. I read a forum thread "How do you know if the screen is locked or not?" tells about only keygaurd/flip phones receive screen lock/unlock or idle and nonidle notifications.
I hope idle or nonidle and screen lock and unlock are one and the same.
Is this applies Please let me know.
 
Thanks
Pallavi

As above said for idle or nonidle notification i did implement the above code and tested in HTC Freestyle F5151. But notgettings any notifications for the same. I read a forum thread "How do you know if the screen is locked or not?" tells about only keygaurd/flip phones receive screen lock/unlock or idle and nonidle notifications.
I hope idle or nonidle and screen lock and unlock are one and the same.
Is this applies Please let me know.
 
Thanks
Pallavi

Idle screen is first screen of the handset. Locking/Unlocking may take you to idle/non-idle screen.

Idle screen is first screen of the handset. Locking/Unlocking may take you to idle/non-idle screen.