Class AlarmManager
Definition
- Namespace:
- Tizen.Applications
- Assembly:
- Tizen.Applications.Alarm.dll
- API Level:
- 3
Mobile devices typically give constant access to information from various sources. Some of this information is best delivered through alarms. The most obvious case is a calendar scheduling application, which lets you know when a meeting is about to start. Alarms are certainly better than actively waiting in a loop. They are also better than putting an interface to sleep because they do not block your main UI thread. Use of alarms helps build smooth user experiences and implements unattended data synchronization tasks. If an application is installed after setting the alarm, your alarm is canceled automatically.
public static class AlarmManager
- Inheritance
-
AlarmManager
Examples
public class AlarmManagerExample
{
/// ...
Alarm alarm = AlarmManager.CreateAlarm(24000,1000,null);
AlarmManager.CancelAll();
}
Methods
View SourceCancelAll()
Cancels all scheduled alarms that are registered by the application that calls this API.
Declaration
public static void CancelAll()
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.set
View SourceCreateAlarm(DateTime, AlarmWeekFlag, AppControl)
Sets an alarm to be triggered periodically, starting at a specific time. The date describes the time of the first occurrence. The weekFlag is the repeat value of the days of the week. If the weekFlag is AlarmWeekFlag.Tuesday, the alarm will repeat every Tuesday at a specific time.
Declaration
public static Alarm CreateAlarm(DateTime value, AlarmWeekFlag weekFlag, AppControl appControl)
Parameters
Type | Name | Description |
---|---|---|
DateTime | value | The first active alarm time. |
AlarmWeekFlag | weekFlag | The day of the week, AlarmWeekFlag may be a combination of days, like AlarmWeekFlag.Sunday | AlarmWeekFlag.Monday. |
AppControl | appControl | The destination AppControl to perform specific work when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Remarks
This operation is permitted with UI application appcontrol only.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
View SourceCreateAlarm(DateTime, AlarmWeekFlag, Notification)
Sets a notification alarm to be triggered periodically, starting at a specific time. The date describes the time of the first occurrence. The weekFlag is the repeat value of the days of the week. If the weekFlag is AlarmWeekFlag.Tuesday, the alarm will repeat every Tuesday at a specific time.
Declaration
public static Alarm CreateAlarm(DateTime dateTime, AlarmWeekFlag weekFlag, Notification notification)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | The first active alarm time. |
AlarmWeekFlag | weekFlag | The day of the week, AlarmWeekFlag may be a combination of days, like AlarmWeekFlag.Sunday | AlarmWeekFlag.Monday. |
Notification | notification | The notification to be posted when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
View SourceCreateAlarm(DateTime, AppControl)
Sets an alarm to be triggered at a specific time. The date describes the time of the first occurrence.
Declaration
public static Alarm CreateAlarm(DateTime value, AppControl appControl)
Parameters
Type | Name | Description |
---|---|---|
DateTime | value | The first active alarm time. |
AppControl | appControl | The destination AppControl to perform specific work when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Remarks
This operation is permitted with the UI application appcontrol only.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
View SourceCreateAlarm(DateTime, Notification)
Sets a notification alarm to be triggered at a specific time. The date describes the time of the first occurrence.
Declaration
public static Alarm CreateAlarm(DateTime dateTime, Notification notification)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | The first active alarm time. |
Notification | notification | The notification to be posted when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
View SourceCreateAlarm(Int32, Int32, AppControl)
Sets an alarm to be triggered after a specific time. The alarm will first go off delay seconds later and then will go off every certain amount of time defined using period seconds.
Declaration
public static Alarm CreateAlarm(int delay, int period, AppControl appControl)
Parameters
Type | Name | Description |
---|---|---|
Int32 | delay | The amount of time before the first execution (in seconds). |
Int32 | period | The amount of time between subsequent alarms (in seconds). This value does not guarantee the accuracy. The actual interval is calculated by the OS. The minimum value is 600sec. |
AppControl | appControl | The destination AppControl is used to perform a specific task when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.set
View SourceCreateAlarm(Int32, Int32, Notification)
Sets a notification alarm to be triggered after a specific time. The alarm will first go off delay seconds later and then will go off every certain amount of time defined using period seconds.
Declaration
public static Alarm CreateAlarm(int delay, int period, Notification notification)
Parameters
Type | Name | Description |
---|---|---|
Int32 | delay | The amount of time before the first execution (in seconds). |
Int32 | period | The amount of time between subsequent alarms (in seconds). This value does not guarantee the accuracy. |
Notification | notification | The notification to be posted when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.sethttp://tizen.org/privilege/notification
View SourceCreateAlarm(Int32, AlarmStandardPeriod, AppControl)
Sets an alarm to be triggered after a specific time. The alarm will first go off delay seconds later and then will go off every certain amount of time defined using standard period seconds.
Declaration
public static Alarm CreateAlarm(int delay, AlarmStandardPeriod standardPeriod, AppControl appControl)
Parameters
Type | Name | Description |
---|---|---|
Int32 | delay | The amount of time before the first execution (in seconds). |
AlarmStandardPeriod | standardPeriod | It can be the AlarmStandardPeriod. If then, the period of alarm is guaranteed. |
AppControl | appControl | The destination AppControl is used to perform a specific task when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 8
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.set
View SourceCreateAlarm(Int32, AlarmStandardPeriod, Notification)
Sets a notification alarm to be triggered after a specific time. The alarm will first go off delay seconds later and then will go off every certain amount of time defined using period seconds.
Declaration
public static Alarm CreateAlarm(int delay, AlarmStandardPeriod standardPeriod, Notification notification)
Parameters
Type | Name | Description |
---|---|---|
Int32 | delay | The amount of time before the first execution (in seconds). |
AlarmStandardPeriod | standardPeriod | It can be the AlarmStandardPeriod. If then, the period of alarm is guaranteed. |
Notification | notification | The notification to be posted when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 8
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.sethttp://tizen.org/privilege/notification
View SourceCreateAlarm(Int32, AppControl)
Sets an alarm to be triggered after a specific time. The alarm will go off delay seconds later.
Declaration
public static Alarm CreateAlarm(int delay, AppControl appControl)
Parameters
Type | Name | Description |
---|---|---|
Int32 | delay | The amount of time before the execution (in seconds). |
AppControl | appControl | The destination AppControl to perform a specific task when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.set
View SourceCreateAlarm(Int32, Notification)
Sets a notification alarm to be triggered after a specific time. The alarm will go off delay seconds later.
Declaration
public static Alarm CreateAlarm(int delay, Notification notification)
Parameters
Type | Name | Description |
---|---|---|
Int32 | delay | The amount of time before the first execution (in seconds). |
Notification | notification | The notification to be posted when the alarm is triggered. |
Returns
Type | Description |
---|---|
Alarm | An alarm instance is created with the set param values. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown in case of an invalid parameter. |
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.sethttp://tizen.org/privilege/notification
View SourceGetAllScheduledAlarms()
Retrieves all registered alarms.
Declaration
public static IEnumerable<Alarm> GetAllScheduledAlarms()
Returns
Type | Description |
---|---|
IEnumerable<Alarm> | List of all alarm instances. |
Exceptions
Type | Condition |
---|---|
UnauthorizedAccessException | Thrown in case of a permission denied. |
InvalidOperationException | Thrown in case of any internal error. |
API Level: 4
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.get
View SourceGetCurrentTime()
Gets the current system time.
Declaration
public static DateTime GetCurrentTime()
Returns
Type | Description |
---|---|
DateTime | The current system time. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown in case of any internal error. |