reminder applicatio | developer.brewmp.com reminder applicatio | developer.brewmp.com

Developer

reminder applicatio

Forums:

As we are doing a reminder kind of application i want my application to be started
on particular device time and date, i did study the backgroung applications a bit and i uderstood, but i coudnt get hw to self invoke applet once it is in background to fore ground without another applet sending event to it, if some one can put light on this would be helpful for me

regards
manju

Listen some event, such as register notify, or register some Callback using BREW standard Interface.
when catch some event, call ISHELL_StartApplet to launch self to foreground. example as below:
ISHELL_RegisterNotify(,,AEECLSID_TAPI,NMASK_TAPI_SMS_TEXT)
.......
in background.
When receive SMS:
case EVT_Notify:
process it
ISHELL_StartApplet to start self

Listen some event, such as register notify, or register some Callback using BREW standard Interface.
when catch some event, call ISHELL_StartApplet to launch self to foreground. example as below:
ISHELL_RegisterNotify(,,AEECLSID_TAPI,NMASK_TAPI_SMS_TEXT)
.......
in background.
When receive SMS:
case EVT_Notify:
process it
ISHELL_StartApplet to start self

Hi Manju,
As per your problem description, I don't think that you need a background application. It seems that You just need a reminder application which can start itself at the particular date and time.
For this purpose; you can use ISHELL_SetAlarm() API; here, On expiration of certain time duration; your applet will be getting EVT_ALARM event. You can easily check the class_id of the active applet, and if active applet is not your applet then you can start your applet by calling ISHELL_StartApplet().
Hope this suffices your query...
~~~~~~
SoftEast
~~~~~~

Hi Manju,
As per your problem description, I don't think that you need a background application. It seems that You just need a reminder application which can start itself at the particular date and time.
For this purpose; you can use ISHELL_SetAlarm() API; here, On expiration of certain time duration; your applet will be getting EVT_ALARM event. You can easily check the class_id of the active applet, and if active applet is not your applet then you can start your applet by calling ISHELL_StartApplet().
Hope this suffices your query...
~~~~~~
SoftEast
~~~~~~

hi,
im getting memory corrupted on my emulator display peculiar i felt
at WSTRLEN and WSTRTOSTR code in below code, why??
void save_reminder(myexample* pMe)
{
JulianType pDate;
int n=0;
AECHAR *hours=NULL;
AECHAR *minutes=NULL;
char* hrs;
char* mins;
int h=0;
int m=0;
GET_JULIANDATE(GETTIMESECONDS(),&pDate);
hours=ITEXTCTL_GetTextPtr(pMe->p_txt);
minutes=ITEXTCTL_GetTextPtr(pMe->p_txt1);
ITEXTCTL_Release(pMe->p_txt);
ITEXTCTL_Release(pMe->p_txt1);
n=WSTRLEN (hours);
hours[n]='\0';
hrs=(char *)MALLOC(n+2);
if(hrs==NULL)
return;
WSTRTOSTR (hours,hrs,n+1);
h=ATOI(hrs);
n=WSTRLEN (minutes);
minutes[n]='\0';
mins=(char *)MALLOC(n+2);
if(mins==NULL)
return;
WSTRTOSTR (minutes,mins,n+1);
m=ATOI(mins);
n=((h*60)+m)-((pDate.wHour*60)+pDate.wMinute);
FREEIF(hrs);
FREEIF(mins);
ISHELL_SetAlarm(pMe->a.m_pIShell,AEECLSID_MYEXAMPLE,EVT_ALARM,n);
Createdatabase(pMe);

hi,
im getting memory corrupted on my emulator display peculiar i felt
at WSTRLEN and WSTRTOSTR code in below code, why??
void save_reminder(myexample* pMe)
{
JulianType pDate;
int n=0;
AECHAR *hours=NULL;
AECHAR *minutes=NULL;
char* hrs;
char* mins;
int h=0;
int m=0;
GET_JULIANDATE(GETTIMESECONDS(),&pDate);
hours=ITEXTCTL_GetTextPtr(pMe->p_txt);
minutes=ITEXTCTL_GetTextPtr(pMe->p_txt1);
ITEXTCTL_Release(pMe->p_txt);
ITEXTCTL_Release(pMe->p_txt1);
n=WSTRLEN (hours);
hours[n]='\0';
hrs=(char *)MALLOC(n+2);
if(hrs==NULL)
return;
WSTRTOSTR (hours,hrs,n+1);
h=ATOI(hrs);
n=WSTRLEN (minutes);
minutes[n]='\0';
mins=(char *)MALLOC(n+2);
if(mins==NULL)
return;
WSTRTOSTR (minutes,mins,n+1);
m=ATOI(mins);
n=((h*60)+m)-((pDate.wHour*60)+pDate.wMinute);
FREEIF(hrs);
FREEIF(mins);
ISHELL_SetAlarm(pMe->a.m_pIShell,AEECLSID_MYEXAMPLE,EVT_ALARM,n);
Createdatabase(pMe);

yes, "Application Crash" is obvious here.
As you are using ITEXTCTL_GetTextPtr(); which does not create a fresh memory for you, but instead, it gives the same pointer which text control object is using. and in the next lines you have release the TextCrl object so at this time all the text buffers are released.
Now if you perform any operation with the pointer returned earlier by ITEXTCTL_GetTextPtr(); it is dangling pointer.
u should use ITEXTCTL_GetText() instead.
~~~~~~
SoftEast
~~~~~~

yes, "Application Crash" is obvious here.
As you are using ITEXTCTL_GetTextPtr(); which does not create a fresh memory for you, but instead, it gives the same pointer which text control object is using. and in the next lines you have release the TextCrl object so at this time all the text buffers are released.
Now if you perform any operation with the pointer returned earlier by ITEXTCTL_GetTextPtr(); it is dangling pointer.
u should use ITEXTCTL_GetText() instead.
~~~~~~
SoftEast
~~~~~~

thanks,solved. mistake i was doing, was not looking at it as in i was in ahurry.
i used alaram api its enough for ma req

thanks,solved. mistake i was doing, was not looking at it as in i was in ahurry.
i used alaram api its enough for ma req

da problem for me is when my applet is closed my applet is not getting invoked through alaram, well da problem is i have set this alaram in not my main .c file(ie calender.c), where as i have set it in a included file(ie bundle.c ) im not getting alert when app is closed, on active appl is getting evt_alaram;
//bundle.c
ISHELL_SetAlarm(pMe->pIShell,AEECLSID_CALENDAR,EVT_ALARM,pMe->timer);
//calender.c
case EVT_ALARM:
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);
im not able to understand and if i set timer in my main file i get alert in both cases :confused:

da problem for me is when my applet is closed my applet is not getting invoked through alaram, well da problem is i have set this alaram in not my main .c file(ie calender.c), where as i have set it in a included file(ie bundle.c ) im not getting alert when app is closed, on active appl is getting evt_alaram;
//bundle.c
ISHELL_SetAlarm(pMe->pIShell,AEECLSID_CALENDAR,EVT_ALARM,pMe->timer);
//calender.c
case EVT_ALARM:
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);
im not able to understand and if i set timer in my main file i get alert in both cases :confused:

Hi Manju,
1. Do both "Calendar.c" & "bundle.c" exist in same project (which has class id=AEECLSID_CALENDAR) ?
I am asking this question because you can set alarm for your applet only, plz ensure this...
2. Also there is a problem in this code:
//calender.c
case EVT_ALARM:
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);
/////////////////////
You should not start the applet every time u get EVT_ALARM. There could be the case when your applet is already running and u r getting ALARM event. It should be like
/////////////////////////////////////////
case EVT_ALARM:
iAEEClass=ISHELL_ActiveApplet(pMe->m_pIShell);//returns active applet's cls id
if(iAEEClass!=AEECLSID_CALENDAR)
{
//your applet is not active
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);

else
{
//active applet is your applet only (no need to start the applet)... go ahead....

/////////////////////////////////////////
~~~~~~
SoftEast
~~~~~~

Hi Manju,
1. Do both "Calendar.c" & "bundle.c" exist in same project (which has class id=AEECLSID_CALENDAR) ?
I am asking this question because you can set alarm for your applet only, plz ensure this...
2. Also there is a problem in this code:
//calender.c
case EVT_ALARM:
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);
/////////////////////
You should not start the applet every time u get EVT_ALARM. There could be the case when your applet is already running and u r getting ALARM event. It should be like
/////////////////////////////////////////
case EVT_ALARM:
iAEEClass=ISHELL_ActiveApplet(pMe->m_pIShell);//returns active applet's cls id
if(iAEEClass!=AEECLSID_CALENDAR)
{
//your applet is not active
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);

else
{
//active applet is your applet only (no need to start the applet)... go ahead....

/////////////////////////////////////////
~~~~~~
SoftEast
~~~~~~

Softeast wrote:
1. Do both "Calendar.c" & "bundle.c" exist in same project (which has class id=AEECLSID_CALENDAR) ?I am asking this question because you can set alarm for your applet only, plz ensure this...
yes exist in same project
Softeast wrote:
2. Also there is a problem in this code:
//calender.c
case EVT_ALARM:
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);
/////////////////////
You should not start the applet every time u get EVT_ALARM. There could be the case when your applet is already running and u r getting ALARM event. It should be like
/////////////////////////////////////////
case EVT_ALARM:
iAEEClass=ISHELL_ActiveApplet(pMe->m_pIShell);//returns active applet's cls id
if(iAEEClass!=AEECLSID_CALENDAR)
{
//your applet is not active
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);

else
{
//active applet is your applet only (no need to start the applet)... go ahead....

/////////////////////////////////////////
~~~~~~
SoftEast...
i have done this in my code but dint paste it in da eg code

Softeast wrote:
1. Do both "Calendar.c" & "bundle.c" exist in same project (which has class id=AEECLSID_CALENDAR) ?I am asking this question because you can set alarm for your applet only, plz ensure this...
yes exist in same project
Softeast wrote:
2. Also there is a problem in this code:
//calender.c
case EVT_ALARM:
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);
/////////////////////
You should not start the applet every time u get EVT_ALARM. There could be the case when your applet is already running and u r getting ALARM event. It should be like
/////////////////////////////////////////
case EVT_ALARM:
iAEEClass=ISHELL_ActiveApplet(pMe->m_pIShell);//returns active applet's cls id
if(iAEEClass!=AEECLSID_CALENDAR)
{
//your applet is not active
ISHELL_StartApplet(pMe->pIShell,AEECLSID_CALENDAR);
return(TRUE);

else
{
//active applet is your applet only (no need to start the applet)... go ahead....

/////////////////////////////////////////
~~~~~~
SoftEast...
i have done this in my code but dint paste it in da eg code

can any one help me in above case :confused:

can any one help me in above case :confused:

I think the problem might be in 3rd param of API...
ISHELL_SetAlarm ( pIShell, cls, uint16 nUserCode, nMins )
i.e. "nUserCode"; check if you are passing applet pointer (pMe) for this or some other (from both bundle.c and calendar.c ......)

I think the problem might be in 3rd param of API...
ISHELL_SetAlarm ( pIShell, cls, uint16 nUserCode, nMins )
i.e. "nUserCode"; check if you are passing applet pointer (pMe) for this or some other (from both bundle.c and calendar.c ......)

i dint get wat ur saying hw can i pass applet ptr in place of usercode,

i dint get wat ur saying hw can i pass applet ptr in place of usercode,

...was my mistake... I had some different frame of reference...

...was my mistake... I had some different frame of reference...

problem with ishell_setalarm...
im getting peculiar behaviour with setalarm function, alarm sets up correctly and my applet gets invoked im in da same screen where i invoked alarm, but if i get into different screen(still im in application itself) evt_alarm does nt get call at all, 100% gets called when im in same screen and i would like 2 add dat i have not included any code in other screens which makes alarm cancel/suspend, im facing these problems in devices like lg6335, huwaei and other lg devices,
but same code is working on v3c perfectly, set alarm showing ideal bahviour and gets invoked where ever u are
any help will be greatful

problem with ishell_setalarm...
im getting peculiar behaviour with setalarm function, alarm sets up correctly and my applet gets invoked im in da same screen where i invoked alarm, but if i get into different screen(still im in application itself) evt_alarm does nt get call at all, 100% gets called when im in same screen and i would like 2 add dat i have not included any code in other screens which makes alarm cancel/suspend, im facing these problems in devices like lg6335, huwaei and other lg devices,
but same code is working on v3c perfectly, set alarm showing ideal bahviour and gets invoked where ever u are
any help will be greatful

problem resolved,
as in i was using timer in other screens, once i removed it alarm coming in every screen, i think priority goes to timer infront of set_alarm function.. :)

problem resolved,
as in i was using timer in other screens, once i removed it alarm coming in every screen, i think priority goes to timer infront of set_alarm function.. :)