query abt background applets | developer.brewmp.com query abt background applets | developer.brewmp.com

Developer

query abt background applets

Forums:

Hi all,

i just had a few queries abt the functioning of backgrd applets... i read a doc abt the bg applets but it didnt solve all my doubts..

i wanted to know a few things:

1. is there any way to know my bg app is running successfully or no??

2. how do i close the bg app ?

3. can i change my present applet to run as a backgrd applet at the evt_app_stop event and then continue processing at the backgrd??

4. also does sdk2.1.0 support bg apps?? if yes then why am i getting error for AEECLSID_BGAPP??

could any1 pls help me solve my doubts..

thnks in advance
pribhi.

pribhi wrote:
1. is there any way to know my bg app is running successfully or no??
Not in BREW 2.x. In BREW 3.x you can use IAPPLETCTL.
pribhi wrote:
2. how do i close the bg app ?
ISHELL_CloseApplet().
pribhi wrote:
3. can i change my present applet to run as a backgrd applet at the evt_app_stop event and then continue processing at the backgrd??
Yes, but you need to have some way to terminate it when the processing ends.
pribhi wrote:
4. also does sdk2.1.0 support bg apps?? if yes then why am i getting error for AEECLSID_BGAPP??
BREW 2.x supports background apps. What do you mean by "getting error for AEECLSID_BGAPP"?

pribhi wrote:
1. is there any way to know my bg app is running successfully or no??
Not in BREW 2.x. In BREW 3.x you can use IAPPLETCTL.
pribhi wrote:
2. how do i close the bg app ?
ISHELL_CloseApplet().
pribhi wrote:
3. can i change my present applet to run as a backgrd applet at the evt_app_stop event and then continue processing at the backgrd??
Yes, but you need to have some way to terminate it when the processing ends.
pribhi wrote:
4. also does sdk2.1.0 support bg apps?? if yes then why am i getting error for AEECLSID_BGAPP??
BREW 2.x supports background apps. What do you mean by "getting error for AEECLSID_BGAPP"?

thnks for ur reply..
i am getting an error for AEECLSID_BGAPP: error: AEECLSID_BGAPP' : undeclared identifier
also aeeclsid list specified in the help docs for 2.1.0 doesnot contain aeeclsid_bgapp.
could some1 tell me why is this so..
thnks
pribhi

thnks for ur reply..
i am getting an error for AEECLSID_BGAPP: error: AEECLSID_BGAPP' : undeclared identifier
also aeeclsid list specified in the help docs for 2.1.0 doesnot contain aeeclsid_bgapp.
could some1 tell me why is this so..
thnks
pribhi

Why would you expect it to exist? I think that's just an arbitrary constant used for the document. You would replace that with the class ID of your own app.

Why would you expect it to exist? I think that's just an arbitrary constant used for the document. You would replace that with the class ID of your own app.

ya i know.. was a stupid mistake on myside..
i changed it to appid for my application but it is now returning failed for ishell_startapplet...
wht could be the reason for tht...
also can u suggest me some way to terminate my present applet which is changed to a backgrd applet..
thnks again..
pribhi

ya i know.. was a stupid mistake on myside..
i changed it to appid for my application but it is now returning failed for ishell_startapplet...
wht could be the reason for tht...
also can u suggest me some way to terminate my present applet which is changed to a backgrd applet..
thnks again..
pribhi

actually let me tell u what i am trying to do in my application...
this will help u understand where i am going wrong exactlly...
switch (eCode){
case EVT_APP_START:
return(TRUE);
case EVT_APP_STOP:
*((boolean*) dwParam) = FALSE;
// after this my app goes into background
//call to function to be executed in background
id= ISHELL_StartApplet(pApp->a.m_pIShell, pApp->a.clsID );
ISHELL_CloseApplet(pApp->a.m_pIShell, TRUE);
return TRUE;

but my ishell_startapplet returns failed and also the applet is not being released..
could u pls tell me where am i going wrong??
thks again
pribhi

actually let me tell u what i am trying to do in my application...
this will help u understand where i am going wrong exactlly...
switch (eCode){
case EVT_APP_START:
return(TRUE);
case EVT_APP_STOP:
*((boolean*) dwParam) = FALSE;
// after this my app goes into background
//call to function to be executed in background
id= ISHELL_StartApplet(pApp->a.m_pIShell, pApp->a.clsID );
ISHELL_CloseApplet(pApp->a.m_pIShell, TRUE);
return TRUE;

but my ishell_startapplet returns failed and also the applet is not being released..
could u pls tell me where am i going wrong??
thks again
pribhi

Why are you calling ISHELL_StartApplet()? Are you trying to start the same application that is receiving the EVT_APP_STOP event, or is this a separate applet?

Why are you calling ISHELL_StartApplet()? Are you trying to start the same application that is receiving the EVT_APP_STOP event, or is this a separate applet?

hi!
thanks for the reply..
i am using ishell_startapplet after functioning of a process that is running in background is complete...
i am not being able to close to background applet.. so i tried to active it again and then called ishell_closeapplet...
can some1 suggest me how to close the background applet...
also i tried using ishell_closeapplet(pMe->a.m_pIShell, TRUE); but even that doesnt work...
pls help me solve the problem...
thanks pribhi.

hi!
thanks for the reply..
i am using ishell_startapplet after functioning of a process that is running in background is complete...
i am not being able to close to background applet.. so i tried to active it again and then called ishell_closeapplet...
can some1 suggest me how to close the background applet...
also i tried using ishell_closeapplet(pMe->a.m_pIShell, TRUE); but even that doesnt work...
pls help me solve the problem...
thanks pribhi.

Going to the background is not a synchronous process after you change the boolean (the application doesn't go background immediately after changing the boolean value). The background transition happens after your app has returned from the event handler for EVT_APP_STOP. You shouldn't be calling ISHELL_StartApplet() until after the background process has completed. Also, your call to the method that's going on in the background should not be a synchronous call -- use ISHELL_Resume() or some sort of time to start it so that your application has time to transition into the background.

Going to the background is not a synchronous process after you change the boolean (the application doesn't go background immediately after changing the boolean value). The background transition happens after your app has returned from the event handler for EVT_APP_STOP. You shouldn't be calling ISHELL_StartApplet() until after the background process has completed. Also, your call to the method that's going on in the background should not be a synchronous call -- use ISHELL_Resume() or some sort of time to start it so that your application has time to transition into the background.

hi,
i tried calling the background process IShell_settimer...
following is the code after changes..
here is the main handleevent function
Myapplication_HandleEvent()
{
case EVT_APP_START:
return TRUE;
case EVT_APP_STOP:
if(pApp->bgapp == FALSE)
{
*((boolean*) dwParam) = FALSE;
pApp->bgapp = TRUE;
ISHELL_SetTimer( pApp->a.m_pIShell, 100, (PFNNOTIFY)MyApplication_FreeApp, pApp);
}
return TRUE;

here is the backgrd process
void MyApplication_BckApp(MyApp * pApp)
{
//some code
ITEXTCTL_Release(pApp->m_Text );
pApp->m_Text = NULL;
IMENUCTL_Release(pApp->m_Menu );
pApp->m_Menu = NULL;
ISHELL_CloseApplet(pApp->a.m_pIShell, TRUE);

could u pls tell me ... is what i am doing right... or am i still missing something..
bcoz when the next time i call my application, it begins processing with the same previous values..
thnks pribhi

hi,
i tried calling the background process IShell_settimer...
following is the code after changes..
here is the main handleevent function
Myapplication_HandleEvent()
{
case EVT_APP_START:
return TRUE;
case EVT_APP_STOP:
if(pApp->bgapp == FALSE)
{
*((boolean*) dwParam) = FALSE;
pApp->bgapp = TRUE;
ISHELL_SetTimer( pApp->a.m_pIShell, 100, (PFNNOTIFY)MyApplication_FreeApp, pApp);
}
return TRUE;

here is the backgrd process
void MyApplication_BckApp(MyApp * pApp)
{
//some code
ITEXTCTL_Release(pApp->m_Text );
pApp->m_Text = NULL;
IMENUCTL_Release(pApp->m_Menu );
pApp->m_Menu = NULL;
ISHELL_CloseApplet(pApp->a.m_pIShell, TRUE);

could u pls tell me ... is what i am doing right... or am i still missing something..
bcoz when the next time i call my application, it begins processing with the same previous values..
thnks pribhi

hi!
i have found out the problem... and the application is now working fine in background and also is getting closed properly...
these are the changes in the code
in the main handle event function
Myapplication_HandleEvent()
{
case EVT_APP_START:
return TRUE;
case EVT_APP_STOP:
if(pApp->bgapp == FALSE)
{
*((boolean*) dwParam) = FALSE;
pApp->bgapp = TRUE;
ISHELL_SetTimer( pApp->a.m_pIShell, 100, (PFNNOTIFY)MyApplication_FreeApp, pApp);
}
else
// free applet data
return TRUE;

and in the background process
void MyApplication_BckApp(MyApp * pApp)
{
//some code for bg app
ISHELL_CloseApplet(pApp->a.m_pIShell, FALSE);

thnks for all ur help
pribhi

hi!
i have found out the problem... and the application is now working fine in background and also is getting closed properly...
these are the changes in the code
in the main handle event function
Myapplication_HandleEvent()
{
case EVT_APP_START:
return TRUE;
case EVT_APP_STOP:
if(pApp->bgapp == FALSE)
{
*((boolean*) dwParam) = FALSE;
pApp->bgapp = TRUE;
ISHELL_SetTimer( pApp->a.m_pIShell, 100, (PFNNOTIFY)MyApplication_FreeApp, pApp);
}
else
// free applet data
return TRUE;

and in the background process
void MyApplication_BckApp(MyApp * pApp)
{
//some code for bg app
ISHELL_CloseApplet(pApp->a.m_pIShell, FALSE);

thnks for all ur help
pribhi