Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

According to the TBT the application should exit to application manager when user selects the exit option in the application.
I am facing one issue that while selecting the exit,it is exiting to the phone OS instead of the application manager.

We are useing ISHELL_CloseApplet(shell, FALSE); to close the application.
I tried with making the boolean TRUE,still it is exiting to phone OS.
Is there any way to exit the application to the Brew Application Manager instead of the phone OS?

When should we use ISHELL_CloseApplet(shell, TRUE);

If we use TRUE then PL_SYSTEM is required to call this function .

bReturnToIdle : This parameter indicates whether BREW must close all active applications and return to the idle screen. If FALSE, only the currently running applet is closed. If TRUE, all active applications are closed. PL_SYSTEM is required to call this function with bReturnToIdle set to TRUE.

but this PL_SYSTEM is only available to carriers and device manufactures.
While setting the advance previlege in the mif, It informs that these are available to carrier and device manufacturers, if you set this your application will fail TBT.

PL_SYSTEM :The application has all of the above privilege levels and additional functionality (this privilege level is only available to carriers and
device manufacturers).

Thanks and Regards,
Jayawant Jagtap

ISHELL_CloseApplet(shell, bReturnToIdle)
bReturnToIdle indicates whether BREW must close all active applications and return to the idle screen. If FALSE, only the currently running applet is closed. If TRUE, all applications having a history entry are closed (background applications don't have history entries). PL_SYSTEM is required to call this function with bReturnToIdle set to TRUE.
ISHELL_CloseApplet(shell, FALSE) should close only your app and go to BAM screen. Try on some other handset; as it may be device specific behavior.

ISHELL_CloseApplet(shell, bReturnToIdle)
bReturnToIdle indicates whether BREW must close all active applications and return to the idle screen. If FALSE, only the currently running applet is closed. If TRUE, all applications having a history entry are closed (background applications don't have history entries). PL_SYSTEM is required to call this function with bReturnToIdle set to TRUE.
ISHELL_CloseApplet(shell, FALSE) should close only your app and go to BAM screen. Try on some other handset; as it may be device specific behavior.

hello Atul,
Thanks for your kind reply,
If i run same build on other device then it exits to BAM, but on only Motorola VE20
it exits on the phone OS.
I think this is not device issue because on the same motorola VE20 device,other applications are exiting on the BAM. ISHELL_CloseApplet with false is used to close all the applications.
If the application exits on the phone OS instead of BAM, will it fail the TBT?
Is there any specific reason so that application should be exit on BAM only?
what wrong thing happens if application exits to phone OS instead of BAM?
Thanks and Regards,
Jayawant Jagtap

hello Atul,
Thanks for your kind reply,
If i run same build on other device then it exits to BAM, but on only Motorola VE20
it exits on the phone OS.
I think this is not device issue because on the same motorola VE20 device,other applications are exiting on the BAM. ISHELL_CloseApplet with false is used to close all the applications.
If the application exits on the phone OS instead of BAM, will it fail the TBT?
Is there any specific reason so that application should be exit on BAM only?
what wrong thing happens if application exits to phone OS instead of BAM?
Thanks and Regards,
Jayawant Jagtap

Hello,
Does BREW provide any way to select where to exit the application(Application Manager or phone OS).
If any application is exiting to phone OS instead of Application Manager and we document it in application specification document, then will NSTL fail the TBT for that build?
Does anyone have any idea about it?
Thanks and Regards,
Jayawant Jagtap

Hello,
Does BREW provide any way to select where to exit the application(Application Manager or phone OS).
If any application is exiting to phone OS instead of Application Manager and we document it in application specification document, then will NSTL fail the TBT for that build?
Does anyone have any idea about it?
Thanks and Regards,
Jayawant Jagtap

One of the possibility is - if you are closing app on CLR key, it may be getting propagated to BAM. Are you closing app on EVT_KEY_PRESS? In this case BAM gets EVT_KEY event. plz check.
NSTL may fail the app - see "IUT Exit" test case in test plan.

One of the possibility is - if you are closing app on CLR key, it may be getting propagated to BAM. Are you closing app on EVT_KEY_PRESS? In this case BAM gets EVT_KEY event. plz check.
NSTL may fail the app - see "IUT Exit" test case in test plan.

Exiting all the following options it is going to Phone OS only,
1.Clear Key on splash screen
2.Flip Event
3.End Key
4.Exit option in the application.

Exiting all the following options it is going to Phone OS only,
1.Clear Key on splash screen
2.Flip Event
3.End Key
4.Exit option in the application.

1 & 4: should go to BAM. Is to possible to share your event handling code?
2 & 3: should go to OEM screen.

1 & 4: should go to BAM. Is to possible to share your event handling code?
2 & 3: should go to OEM screen.

hello,
Please see the following event handling Code,
bool JavaLib::handleEvent(AEEEvent event, uint16 wParam, uint32 dwParam)
{
if(wParam==AVK_CLR)
{
m_bClearKey=true;
}
switch (event)
{
case EVT_KEY_PRESS:
{
keyCode = wParam;
(*midlet->display)->keyEvent(0, wParam);
/*if (keyCode == AVK_CLR &&)
{
}*/
if (keyCode == AEE_AVK_SHIFT || keyCode == AVK_RSHIFT) shift = !shift;
if(keyCode == AEE_AVK_FUNCTION3) symbol = !symbol;
#if defined(DISABLE_QWERTY_KEY_REPEAT)
if ((wParam >= AEE_AVK_BASE && wParam <= AEE_AVK_MAX) || wParam == AEE_AVK_SPACE || wParam == AEE_AVK_SYMBOLS)
#endif
{
ISHELL_SetTimer(shell, 600, (PFNNOTIFY)keyRepeat, this);
}
return true;
}
case EVT_KEY_RELEASE:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
(*midlet->display)->keyEvent(1, wParam);
return true;
}
case EVT_APP_SUSPEND:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
ISHELL_CancelTimer(shell, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
(*(*midlet->display)->current)->hideNotify();
midlet->pauseApp();
return true;
}
case EVT_APP_RESUME:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
midlet->startApp();
(*(*midlet->display)->current)->showNotify();
ISHELL_SetTimer(shell, 17, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
return true;
}
case EVT_APP_START:
{
midlet->startApp();
ISHELL_SetTimer(shell, 17, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
return true;
}
case EVT_APP_STOP:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
ISHELL_CancelTimer(shell, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
midlet->destroyApp(true);
return true;
}
#ifdef USE_TAPI
case EVT_NOTIFY:
{
AEENotify *pnot = (AEENotify*)dwParam;
if(pnot->cls == AEECLSID_TAPI)
{
#if !defined USE_SMS
TAPIStatus *pstat = (TAPIStatus*)pnot->pData;
if (pstat->state == PS_IDLE && in_call)
{
// ending call, resume game
in_call = false;
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
midlet->startApp();
(*(*midlet->display)->current)->showNotify();
ISHELL_SetTimer(shell, 17, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
}
else if (pstat->state == PS_INCOMING)
{
// call incoming, suspend accordingly
in_call = true;
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
ISHELL_CancelTimer(shell, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
(*(*midlet->display)->current)->hideNotify();
midlet->pauseApp();
}
#else
//If we got here, that means we just received an SMS message
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
ISHELL_CancelTimer(shell, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
//Pause the app so the SMS message will appear on-screen (and sound will thusly play)
(*(*midlet->display)->current)->hideNotify();
midlet->pauseApp();
#endif
}
return true;
}
#endif
case EVT_FLIP:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
if (wParam == FALSE)
{
ISHELL_CloseApplet(shell, FALSE);
return false;
}
else
{
return true;
}
}
case EVT_KEYGUARD:
{
#ifndef IGNORE_KEYGUARD
DBGPRINTF("EVT_KEYGUARD");
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
if (wParam == TRUE)
{
ISHELL_CloseApplet(shell, FALSE);
return false;
}
else
{
return true;
}
#else
return false;
#endif
}
case EVT_BUSY:
{
return false;
}
default:
{
if(m_bClearKey==true)
{
m_bClearKey=false;
return true;
}
return false;
}
}

hello,
Please see the following event handling Code,
bool JavaLib::handleEvent(AEEEvent event, uint16 wParam, uint32 dwParam)
{
if(wParam==AVK_CLR)
{
m_bClearKey=true;
}
switch (event)
{
case EVT_KEY_PRESS:
{
keyCode = wParam;
(*midlet->display)->keyEvent(0, wParam);
/*if (keyCode == AVK_CLR &&)
{
}*/
if (keyCode == AEE_AVK_SHIFT || keyCode == AVK_RSHIFT) shift = !shift;
if(keyCode == AEE_AVK_FUNCTION3) symbol = !symbol;
#if defined(DISABLE_QWERTY_KEY_REPEAT)
if ((wParam >= AEE_AVK_BASE && wParam <= AEE_AVK_MAX) || wParam == AEE_AVK_SPACE || wParam == AEE_AVK_SYMBOLS)
#endif
{
ISHELL_SetTimer(shell, 600, (PFNNOTIFY)keyRepeat, this);
}
return true;
}
case EVT_KEY_RELEASE:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
(*midlet->display)->keyEvent(1, wParam);
return true;
}
case EVT_APP_SUSPEND:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
ISHELL_CancelTimer(shell, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
(*(*midlet->display)->current)->hideNotify();
midlet->pauseApp();
return true;
}
case EVT_APP_RESUME:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
midlet->startApp();
(*(*midlet->display)->current)->showNotify();
ISHELL_SetTimer(shell, 17, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
return true;
}
case EVT_APP_START:
{
midlet->startApp();
ISHELL_SetTimer(shell, 17, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
return true;
}
case EVT_APP_STOP:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
ISHELL_CancelTimer(shell, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
midlet->destroyApp(true);
return true;
}
#ifdef USE_TAPI
case EVT_NOTIFY:
{
AEENotify *pnot = (AEENotify*)dwParam;
if(pnot->cls == AEECLSID_TAPI)
{
#if !defined USE_SMS
TAPIStatus *pstat = (TAPIStatus*)pnot->pData;
if (pstat->state == PS_IDLE && in_call)
{
// ending call, resume game
in_call = false;
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
midlet->startApp();
(*(*midlet->display)->current)->showNotify();
ISHELL_SetTimer(shell, 17, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
}
else if (pstat->state == PS_INCOMING)
{
// call incoming, suspend accordingly
in_call = true;
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
ISHELL_CancelTimer(shell, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
(*(*midlet->display)->current)->hideNotify();
midlet->pauseApp();
}
#else
//If we got here, that means we just received an SMS message
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
ISHELL_CancelTimer(shell, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
//Pause the app so the SMS message will appear on-screen (and sound will thusly play)
(*(*midlet->display)->current)->hideNotify();
midlet->pauseApp();
#endif
}
return true;
}
#endif
case EVT_FLIP:
{
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
if (wParam == FALSE)
{
ISHELL_CloseApplet(shell, FALSE);
return false;
}
else
{
return true;
}
}
case EVT_KEYGUARD:
{
#ifndef IGNORE_KEYGUARD
DBGPRINTF("EVT_KEYGUARD");
ISHELL_CancelTimer(shell, (PFNNOTIFY)keyRepeat, this);
if (wParam == TRUE)
{
ISHELL_CloseApplet(shell, FALSE);
return false;
}
else
{
return true;
}
#else
return false;
#endif
}
case EVT_BUSY:
{
return false;
}
default:
{
if(m_bClearKey==true)
{
m_bClearKey=false;
return true;
}
return false;
}
}

For FLIP/KEYGUARD events: no need to call IShell_CloseApplet, brew will do it if you are not handling these events.
I couldn't see any other exit behavior (like CLR key). I suspect you are closing app on EVT_KEY_PRESS:AVK_CLR key.

For FLIP/KEYGUARD events: no need to call IShell_CloseApplet, brew will do it if you are not handling these events.
I couldn't see any other exit behavior (like CLR key). I suspect you are closing app on EVT_KEY_PRESS:AVK_CLR key.

Hello,
I tried with one sample application on this device, It is exiting properly to the BAM.
even if I close the sample application at event=EVT_KEY_PRESS and wparam=AVK_CLR, it does not exit to phone OS, It exits proplerly to the BREW Application Manager.
Code:-
switch (event)
{
case EVT_APP_START:
IDISPLAY_DrawText(display, AEE_FONT_BOLD, L"HELLO ", -1, 0, 0,
0, IDF_ALIGN_CENTER | IDF_ALIGN_MIDDLE);
IDISPLAY_Update (display);
return (TRUE);
case EVT_KEY_PRESS:
if(wParam==AVK_CLR)
ISHELL_CloseApplet(shell, FALSE);
return (TRUE);
case EVT_APP_STOP:
return TRUE;
default:
return (FALSE);
}
Is there any other possible thing available to make the application exit selectively to either phone OS or on BAM?

Hello,
I tried with one sample application on this device, It is exiting properly to the BAM.
even if I close the sample application at event=EVT_KEY_PRESS and wparam=AVK_CLR, it does not exit to phone OS, It exits proplerly to the BREW Application Manager.
Code:-
switch (event)
{
case EVT_APP_START:
IDISPLAY_DrawText(display, AEE_FONT_BOLD, L"HELLO ", -1, 0, 0,
0, IDF_ALIGN_CENTER | IDF_ALIGN_MIDDLE);
IDISPLAY_Update (display);
return (TRUE);
case EVT_KEY_PRESS:
if(wParam==AVK_CLR)
ISHELL_CloseApplet(shell, FALSE);
return (TRUE);
case EVT_APP_STOP:
return TRUE;
default:
return (FALSE);
}
Is there any other possible thing available to make the application exit selectively to either phone OS or on BAM?

can you please return FALSE for AVK_CLR on splash screen/mainmenu? Plz don't call ISHELL_CloseApplet. Something like:
case AVK_CLR:
if (pMe->OnMainMenu == TRUE) {
// App is on main menu. Pressing CLR key should cause app to exit
return FALSE; //return FALSE so that BREW will now close app

else { // Not on main menu.
// Pressing CLR key should cause app to undo one level of menu nesting.
// Show previous menu in menu hierarchy
return TRUE;

can you please return FALSE for AVK_CLR on splash screen/mainmenu? Plz don't call ISHELL_CloseApplet. Something like:
case AVK_CLR:
if (pMe->OnMainMenu == TRUE) {
// App is on main menu. Pressing CLR key should cause app to exit
return FALSE; //return FALSE so that BREW will now close app

else { // Not on main menu.
// Pressing CLR key should cause app to undo one level of menu nesting.
// Show previous menu in menu hierarchy
return TRUE;

Hello,
I tried with the returning false for AVK_CLR on the splash so brew will close the application,but still the application exiting to the phone OS,
I observed that when i satrt a simple helloworld displaying application in the EVT_APP_START then it exits to the BAM, but when i start the my application then it exits to OS.
The Code for EVT_APP_STARTis as follows:-
case EVT_APP_START:
{
DBGPRINTF("IN EVT APP START");
midlet->startApp();
ISHELL_SetTimer(shell, 17, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
return true;
}
Code for startApp is as follows:-
virtual void startApp()
{
if (resume)
{
}
else
{
game = Game(self);
display = Display::getDisplay(self);
resume = true;
display->setCurrent(game);
thread = Thread(*game);
thread->run();
}
}
Code for run is as follows:-
if(state == Game::STATE_LOADING)
{
loadState++;
switch(loadingMode)
{
case LOAD_APP:
case LOAD_APP_CONT:
loadApp();
break;
case LOAD_EVOLUTION:
loadEvolution();
break;
case LOAD_EDITOR:
loadEditor();
break;
case LOAD_SURVIVAL:
loadSurvival();
break;
case LOAD_ARENA:
loadArena();
break;
}
if(running)
{
display->callSerially((Runnable*)this);
}
return;
}
If Nothing done rather than starting AUT, and then exiting it by any ways it goes to phone OS.

Hello,
I tried with the returning false for AVK_CLR on the splash so brew will close the application,but still the application exiting to the phone OS,
I observed that when i satrt a simple helloworld displaying application in the EVT_APP_START then it exits to the BAM, but when i start the my application then it exits to OS.
The Code for EVT_APP_STARTis as follows:-
case EVT_APP_START:
{
DBGPRINTF("IN EVT APP START");
midlet->startApp();
ISHELL_SetTimer(shell, 17, (PFNNOTIFY)(midlet->display->update), midlet->display->ref);
return true;
}
Code for startApp is as follows:-
virtual void startApp()
{
if (resume)
{
}
else
{
game = Game(self);
display = Display::getDisplay(self);
resume = true;
display->setCurrent(game);
thread = Thread(*game);
thread->run();
}
}
Code for run is as follows:-
if(state == Game::STATE_LOADING)
{
loadState++;
switch(loadingMode)
{
case LOAD_APP:
case LOAD_APP_CONT:
loadApp();
break;
case LOAD_EVOLUTION:
loadEvolution();
break;
case LOAD_EDITOR:
loadEditor();
break;
case LOAD_SURVIVAL:
loadSurvival();
break;
case LOAD_ARENA:
loadArena();
break;
}
if(running)
{
display->callSerially((Runnable*)this);
}
return;
}
If Nothing done rather than starting AUT, and then exiting it by any ways it goes to phone OS.

Hi Jayawant,
I don't think it is possible to gauge the issue without debugging. Can you please open a case with Brew support so that someone can debug your code and help you.

Hi Jayawant,
I don't think it is possible to gauge the issue without debugging. Can you please open a case with Brew support so that someone can debug your code and help you.