Deleting an Alarm

Introduction to topic for overview page or search

Context

The RASCliSession::AlarmDelete() API deletes an alarm from the Alarm Server and returns KErrNone if successful as shown in the following code fragment:

// RASCliSession::TheAlarmServerSession is the alarm server session 
// TAlarmId::id is the unique identifier of the alarm the client needs to delete 
TheAlarmServerSession.AlarmDelete( id );

Deleting an Alarm by Category

You can delete multiple alarm objects by category and can also specify the type of alarms within this category. The following code fragment illustrates how to delete alarms by category:

// Delete all alarms
RArray<TAlarmCategory> categories;
CleanupClosePushL( categories );
TheAlarmServerSession.GetAvailableCategoryListL( categories );
const TInt KAlarmCategoriesCount = categories.Count();
for( TInt i = 0; i<KAlarmCategoriesCount; ++i )
    {
    const TAlarmCategory category = categories[i];
    TheAlarmServerSession.AlarmDeleteAllByCategory( category, EFalse );
    }
CleanupStack::PopAndDestroy( &categories );