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()
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 |
|---|---|---|
| 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.
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 |
|---|---|---|
| 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. |
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 |
|---|---|---|
| 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.
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 |
|---|---|---|
| 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. |
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. |
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. |
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. |
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. |
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.
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. |
CreateAlarmForServiceApp(DateTime, int, AppControl)
Sets an alarm to be triggered at a specific time. The alarm will first go off at a specific time and then will go off every certain amount of time defined using period seconds.
Declaration
public static Alarm CreateAlarmForServiceApp(DateTime value, int period, AppControl appControl)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | value | The first active alarm time. |
| int | period | The amount of time between subsequent alarms (in seconds). |
| 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. |
Remarks
This operation only allows service application which has Background Category to set an exact alarm. This API can have a significant impact on power usage when the device is in idle state, so apps that use it may greatly increase battery consumption. Therefore, caution should be taken when using this API.
CreateAlarmForServiceApp(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 CreateAlarmForServiceApp(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 only allows service application which has Background Category to set an exact alarm.
CreateAlarmForServiceApp(int, AppControl)
Sets an alarm to be triggered after a specific time. The alarm will go off delay seconds later.
Declaration
public static Alarm CreateAlarmForServiceApp(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 only allows service application which has Background Category to set an exact alarm.
GetAllScheduledAlarms()
Retrieves all registered alarms.
Declaration
public static IEnumerable<Alarm> GetAllScheduledAlarms()
Returns
| Type | Description |
|---|---|
| IEnumerable<><Alarm> | List of all alarm instances. |
GetCurrentTime()
Gets the current system time.
Declaration
public static DateTime GetCurrentTime()
Returns
| Type | Description |
|---|---|
| DateTime | The current system time. |