Hi again everyone!
Has anyone tried writing programs that set alarms? I try to set the alarm
(and I think I do it correctly) but I don't get any triggers when the alarm
is supposed to set off. I use TimDateTimeToSeconds() to get the correct
time, and when I check if I indeed set the alarm, I do get a registered
alarm (see code below). But I never get the sysAppLaunchCmdAlarmTriggered
launch cmd. For anyone who's had any experience with the Alarm Manager,
please help. Thanks in advance. I'll appreciate any input!
Colleen
UInt32 AlarmGetTrigger (UInt32* refP) {
UInt16 cardNo;
LocalID dbID;
UInt32 alarmTime = 0;
DmSearchStateType searchInfo;
// get the card number & dataBase ID for the app
DmGetNextDatabaseByTypeCreator (true, &searchInfo, appFileType,
appFileCreator, true, &cardNo, &dbID);
alarmTime = AlmGetAlarm (cardNo, dbID, refP);
return (alarmTime);
}
void AlarmSetTrigger (UInt32 alarmTime, UInt32 ref) {
UInt16 cardNo;
LocalID dbID;
DmSearchStateType searchInfo;
DmGetNextDatabaseByTypeCreator (true, &searchInfo, appFileType,
appFileCreator, true, &cardNo, &dbID);
AlmSetAlarm (cardNo, dbID, ref, alarmTime, true);
}
//code for setting the alarm
DateTimeType startDateTime;
UInt32 startSeconds;
startDateTime.year = 98;
startDateTime.month = 11;
startDateTime.day = 13;
startDateTime.hour = 17;
startDateTime.minute = 49;
startDateTime.second = 0;
startSeconds = TimDateTimeToSeconds(&startDateTime);
AlarmSetTrigger (startSeconds, 0);
//verify that the alarm has been set
startSeconds = AlarmGetTrigger (&ref);
//In Pilot Main, check the cmd (this doesn't get executed)
case sysAppLaunchCmdAlarmTriggered:
AlarmTriggered ((SysAlarmTriggeredParamType *)cmdPBP);
paramType = (SysAlarmTriggeredParamType *)cmdPBP;
paramType->purgeAlarm = true;
FrmAlert (AlarmTriggeredAlert);
break;
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
- Re: Alarm Mgr problems Colleen Dideles
- Re: Alarm Mgr problems Martin Elzen
