Brew Question: Download Brew PDF

What difference is there between using the phones "End" key to close an applet, and using the "Clear" key to close an applet?

Tweet Share WhatsApp

Answer:

An OEM of a particular device (phone) designates key(s) for the following two activities:

A key, that when pressed, will close the current application. Most OEMs designate this to be the AVK_CLR key.
A key, that when pressed, will close all applications. Most OEMs designate this to be the AVK_END key.
When AVK_END is pressed, BREW will immediately send EVT_APP_STOP to the active applet without first sending the AVK_END key. In addition, the FreeAppData() callback routine provided to AEEApplet_New() will be called prior to unloading the applet; no other events or callbacks will occur.
When AVK_CLR is pressed, BREW will first send this event to the applet. If the applet does not handle the event (i.e. returns FALSE in HandleEvent), only then BREW will close the application. In the implementation of your AVK_CLR handler, remember to also call FreeAppData as follows:


case AVK_CLR:

if (pMe->OnMainMenu == TRUE) {

// App is on main menu. Therefore pressing CLR key should cause app to exit

HelloWorld_FreeAppData(pi); //clean up

return FALSE; //return FALSE so that BREW will now close application

}
else { // Not on main menu.

// Therefore pressing CLR key should cause app to undo one level of menu

// nesting. Show previous menu in menu hierarchy

return TRUE;

}

Make sure that your FreeAppletData() properly cleans up all allocated memory and resources. All objects and interfaces created by CreateInstance, CreateDialog, MALLOC, etc., must have an associated call to Release or FREE.

Download Brew PDF Read All 78 Brew Questions
Previous QuestionNext Question
On what devices is BREW supported?Tell me what events must an applet handle?