Class AlarmManager
Definition
- Namespace:
- Tizen.Applications
- Assembly:
- Tizen.Applications.Alarm.dll
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
-
objectAlarmManager
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 |
---|---|
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(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 |
---|---|---|
System.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 |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(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 |
---|---|---|
System.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 |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(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 |
---|---|---|
System.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 |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(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 |
---|---|---|
System.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 |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(int, int, 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 |
---|---|---|
int | delay | The amount of time before the first execution (in seconds). Although this is inexact, the alarm will not fire before this time |
int | 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 |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(int, int, 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 |
---|---|---|
int | delay | The amount of time before the first execution (in seconds). Although this is inexact, the alarm will not fire before this time |
int | 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 |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(int, 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 |
---|---|---|
int | 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 |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(int, 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 |
---|---|---|
int | 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 |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(int, 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 |
---|---|---|
int | 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. |
Remarks
This operation is permitted with the UI application appcontrol only.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
CreateAlarm(int, 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 |
---|---|---|
int | 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 |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
GetAllScheduledAlarms()
Retrieves all registered alarms.
Declaration
public static IEnumerable<Alarm> GetAllScheduledAlarms()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Alarm> | List of all alarm instances. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown in case of a permission denied. |
System.InvalidOperationException | Thrown in case of any internal error. |
GetCurrentTime()
Gets the current system time.
Declaration
public static DateTime GetCurrentTime()
Returns
Type | Description |
---|---|
System.DateTime | The current system time. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown in case of any internal error. |