hide & invoke application | developer.brewmp.com hide & invoke application | developer.brewmp.com

Developer

hide & invoke application

Forums:

hi all

i want my application to hide background by pressing softkey (AVK_SOFT2) & again invoke application using some key combination 12345 ie Short Key Launching :

As Icon of application will not be present hence user will start the application using Short Key combination e.g. 123456.

when i hide the application the control must be on device Active screen. so i can perform normal operation like start other application etc.

does anyone have idea how i can perform this????

thanks in advance

ketan

http://brewforums.qualcomm.com/showthread.php?t=17585
This thread shows how to send an app to the background,you will just want to trigger off a key event instead of EVT_APP_SUSPEND.
http://brewforums.qualcomm.com/showthread.php?t=13261
This thread shows how to get key events while in the background. You will need to register for key notifications.

http://brewforums.qualcomm.com/showthread.php?t=17585
This thread shows how to send an app to the background,you will just want to trigger off a key event instead of EVT_APP_SUSPEND.
http://brewforums.qualcomm.com/showthread.php?t=13261
This thread shows how to get key events while in the background. You will need to register for key notifications.

Greg wrote:http://brewforums.qualcomm.com/showthread.php?t=17585
This thread shows how to send an app to the background,you will just want to trigger off a key event instead of EVT_APP_SUSPEND.
http://brewforums.qualcomm.com/showthread.php?t=13261
This thread shows how to get key events while in the background. You will need to register for key notifications.
hi Greg
Thanks for reply.......
i have made changes accordingly & tested app over simulator(BREW Version 3.0.1). it works. when i sent my app background i can see the Active screen of simulator.but i unable to invoke background app. i have register app for NMASK_SHELL_KEY through mif editor.
the code is
/********************************************************************************/
switch (eCode)
{
case EVT_APP_STOP:
if(pMe->bShutdown)
*((boolean*) dwParam) = FALSE; // set dwParam to run in bg
return(TRUE);
case EVT_NOTIFY:
ISHELL_StartApplet(pMe->a.m_pIShell,AEECLSID_MYDISPLAY);
//here some code for handling key event
return (TRUE);
case EVT_KEY:
switch(wParam)
{
............
case AVK_SOFT2:
ISHELL_CloseApplet(pMe->a.m_pIShell, FALSE); // send applet to
background
pMe->bShutdown =TRUE;
return (TRUE);
...........
}
/***************************************************************************/
if i am wrong the pls correct me......
thanks
ketan

Greg wrote:http://brewforums.qualcomm.com/showthread.php?t=17585
This thread shows how to send an app to the background,you will just want to trigger off a key event instead of EVT_APP_SUSPEND.
http://brewforums.qualcomm.com/showthread.php?t=13261
This thread shows how to get key events while in the background. You will need to register for key notifications.
hi Greg
Thanks for reply.......
i have made changes accordingly & tested app over simulator(BREW Version 3.0.1). it works. when i sent my app background i can see the Active screen of simulator.but i unable to invoke background app. i have register app for NMASK_SHELL_KEY through mif editor.
the code is
/********************************************************************************/
switch (eCode)
{
case EVT_APP_STOP:
if(pMe->bShutdown)
*((boolean*) dwParam) = FALSE; // set dwParam to run in bg
return(TRUE);
case EVT_NOTIFY:
ISHELL_StartApplet(pMe->a.m_pIShell,AEECLSID_MYDISPLAY);
//here some code for handling key event
return (TRUE);
case EVT_KEY:
switch(wParam)
{
............
case AVK_SOFT2:
ISHELL_CloseApplet(pMe->a.m_pIShell, FALSE); // send applet to
background
pMe->bShutdown =TRUE;
return (TRUE);
...........
}
/***************************************************************************/
if i am wrong the pls correct me......
thanks
ketan

Thanks Greg
application is working now....
i have set notification NMASK_SHELL_ALL_KEY in mif editor.
i am able to lauch the application by pressing any single key but i want application to start on certain key combination say 123.
if you have any idea then pls share it.
thanks in advance
ketan

Thanks Greg
application is working now....
i have set notification NMASK_SHELL_ALL_KEY in mif editor.
i am able to lauch the application by pressing any single key but i want application to start on certain key combination say 123.
if you have any idea then pls share it.
thanks in advance
ketan

I would probably do something like this:
Keep an index of where you currently are in the sequence. Each time a key notification comes in, check to see if that key code matches the key code in the sequence at the current index. If it does match, increment the index and if it has made it to the end of the sequence, then activate the app. If it doesn't match, then reset the index back to 0.

I would probably do something like this:
Keep an index of where you currently are in the sequence. Each time a key notification comes in, check to see if that key code matches the key code in the sequence at the current index. If it does match, increment the index and if it has made it to the end of the sequence, then activate the app. If it doesn't match, then reset the index back to 0.

Greg wrote:I would probably do something like this:
Keep an index of where you currently are in the sequence. Each time a key notification comes in, check to see if that key code matches the key code in the sequence at the current index. If it does match, increment the index and if it has made it to the end of the sequence, then activate the app. If it doesn't match, then reset the index back to 0.
hellow Greg
i dont know whether i am getting you or not. what i implemented is
case EVT_NOTIFY:
pNotify = (AEENotify*)dwParam;
NKEvent = (NotifyKeyEvent*) pNotify->pData;
if(pNotify->cls==AEECLSID_SHELL && pNotify->dwMask & NMASK_SHELL_KEY)
{
switch(NKEvent->wParam)
{
case AVK_1:
pMe->pGoIndex = 1;
break;
case AVK_2:
if(pMe->pGoIndex == 1)
pMe->pGoIndex = 1;
else
pMe->pGoIndex++;
break;
case AVK_3:
if(pMe->pGoIndex == 1)
{
ISHELL_StartApplet(.........);
pMe->pGoIndex = 0;
}
else
pMe->pGoIndex++;
default:
break;
}
}
return (TRUE);
its not working for multiple key combination like 123.
if i am wrong somewhere then pls correct it.
thanks
ketan

Greg wrote:I would probably do something like this:
Keep an index of where you currently are in the sequence. Each time a key notification comes in, check to see if that key code matches the key code in the sequence at the current index. If it does match, increment the index and if it has made it to the end of the sequence, then activate the app. If it doesn't match, then reset the index back to 0.
hellow Greg
i dont know whether i am getting you or not. what i implemented is
case EVT_NOTIFY:
pNotify = (AEENotify*)dwParam;
NKEvent = (NotifyKeyEvent*) pNotify->pData;
if(pNotify->cls==AEECLSID_SHELL && pNotify->dwMask & NMASK_SHELL_KEY)
{
switch(NKEvent->wParam)
{
case AVK_1:
pMe->pGoIndex = 1;
break;
case AVK_2:
if(pMe->pGoIndex == 1)
pMe->pGoIndex = 1;
else
pMe->pGoIndex++;
break;
case AVK_3:
if(pMe->pGoIndex == 1)
{
ISHELL_StartApplet(.........);
pMe->pGoIndex = 0;
}
else
pMe->pGoIndex++;
default:
break;
}
}
return (TRUE);
its not working for multiple key combination like 123.
if i am wrong somewhere then pls correct it.
thanks
ketan

The basic idea is that you are always looking for a specific key at any point. If the next key event that comes in is that key, then you start looking for the next key in the sequence (or you start the app if that was the last key in the sequence). If the next key event that comes in is not the key you were looking for, then you start looking at the beginning of the sequence again. Here is what I would do, though I haven't tested it:
#define SEQUENCE_LENGTH 3
UINT16 keySequence[SEQUENCE_LENGTH] = { AVK_1, AVK_2, AVK_3 };
{
case EVT_NOTIFY:
pNotify = (AEENotify*)dwParam;
NKEvent = (NotifyKeyEvent*) pNotify->pData;
if(pNotify->cls==AEECLSID_SHELL && pNotify->dwMask & NMASK_SHELL_KEY)
{
if (keySequence[pMe->pGoIndex] == NKEvent->wParam)
{
++pMe->pGoIndex;
if (pMe->pGoIndex >= SEQUENCE_LENGTH)
{
ISHELL_StartApplet();
}
}
else
{
pMe->pGoIndex = 0;
}
}
return TRUE;

The basic idea is that you are always looking for a specific key at any point. If the next key event that comes in is that key, then you start looking for the next key in the sequence (or you start the app if that was the last key in the sequence). If the next key event that comes in is not the key you were looking for, then you start looking at the beginning of the sequence again. Here is what I would do, though I haven't tested it:
#define SEQUENCE_LENGTH 3
UINT16 keySequence[SEQUENCE_LENGTH] = { AVK_1, AVK_2, AVK_3 };
{
case EVT_NOTIFY:
pNotify = (AEENotify*)dwParam;
NKEvent = (NotifyKeyEvent*) pNotify->pData;
if(pNotify->cls==AEECLSID_SHELL && pNotify->dwMask & NMASK_SHELL_KEY)
{
if (keySequence[pMe->pGoIndex] == NKEvent->wParam)
{
++pMe->pGoIndex;
if (pMe->pGoIndex >= SEQUENCE_LENGTH)
{
ISHELL_StartApplet();
}
}
else
{
pMe->pGoIndex = 0;
}
}
return TRUE;

thanks Greg
but it doesnot work. what happen is at each iteration value of index (pMe->pGoIndex) reset to zero that means values doesnot increase beyond 1.
even i press 123 keys sequencely. At each iteration value doesnt exceeded by 1 which is what happen in normal applet.
second thing is the applet which we want to invoke is background app. & background applet resides outside memory stack.
Is this behaviour is due to this nature of background apps?
pls help me ....
ketan

thanks Greg
but it doesnot work. what happen is at each iteration value of index (pMe->pGoIndex) reset to zero that means values doesnot increase beyond 1.
even i press 123 keys sequencely. At each iteration value doesnt exceeded by 1 which is what happen in normal applet.
second thing is the applet which we want to invoke is background app. & background applet resides outside memory stack.
Is this behaviour is due to this nature of background apps?
pls help me ....
ketan

thanks Greg
i want to know how we can detect there is no RUIM card in device ie the card is not inserted in device? i want background application to invoke and display message if theres no RUIM card inside the device.
Is there any special event for determining the presence of card inside device?
how i can do this.......
pls help
ketan

thanks Greg
i want to know how we can detect there is no RUIM card in device ie the card is not inserted in device? i want background application to invoke and display message if theres no RUIM card inside the device.
Is there any special event for determining the presence of card inside device?
how i can do this.......
pls help
ketan

check out AEETSIMState

check out AEETSIMState

Thanks ashutosh......

Thanks ashutosh......