Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
How to create an alarm using Symbian C++
This code snippet shows how to set an alarm using Symbian C++. This alarm is different from the clock application's alarm and picks the same tone set for the calendar application's alarm. If vibration alert is enabled for the currently set profile, then a vibrating alert will also be played when the alarm expires.
Link Against : alarmclient.lib
Link Against : alarmshared.lib
RASCliSession iSession; // client interface to alarm server
TASShdAlarm iAlarm; //Alarm object
ihomeTime.HomeTime(); // Get Current Hometime(local time set in mobile)
// interval – Give seconds after which alarm should expire
//Returns the time alarm is scheduled to expire
TTime& iNDT = iAlarm.NextDueTime();
//Set the NextDueTime in which alarm will expire
iNDT = ihomeTime + intervalSecs;
imessage.Copy(_L("Alarm")); //Alarm message
The application should have following capabilities for alarm to work. ReadDeviceData, ReadUserData, WriteDeviceData and WriteUserData.
If the application doesn't have any of the above required capabilities, it returns error KErrPermissionDenied(-46).