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.

C#
Copy
public static class AlarmManager
Inheritance
System.Object
AlarmManager
Examples
Copy
public class AlarmManagerExample { /// ... Alarm alarm = AlarmManager.CreateAlarm(24000,1000,null); AlarmManager.CancelAll(); }

Methods

View Source

CancelAll()

Cancels all scheduled alarms that are registered by the application that calls this API.

Declaration
C#
Copy
public static void CancelAll()
Exceptions
Type Condition
UnauthorizedAccessException

Thrown in case of a permission denied.

System.InvalidOperationException

Thrown in case of any internal error.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.set
View Source

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
C#
Copy
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.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.InvalidOperationException

Thrown in case of any internal error.

API Level: 3
View Source

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
C#
Copy
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.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.InvalidOperationException

Thrown in case of any internal error.

API Level: 3
View Source

CreateAlarm(DateTime, AppControl)

Sets an alarm to be triggered at a specific time. The date describes the time of the first occurrence.

Declaration
C#
Copy
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.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.InvalidOperationException

Thrown in case of any internal error.

API Level: 3
View Source

CreateAlarm(DateTime, Notification)

Sets a notification alarm to be triggered at a specific time. The date describes the time of the first occurrence.

Declaration
C#
Copy
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.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.InvalidOperationException

Thrown in case of any internal error.

API Level: 3
View Source

CreateAlarm(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
C#
Copy
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
System.ArgumentException

Thrown in case of an invalid parameter.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.InvalidOperationException

Thrown in case of any internal error.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.set
View Source

CreateAlarm(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
C#
Copy
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
System.ArgumentException

Thrown in case of an invalid parameter.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.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 Source

CreateAlarm(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
C#
Copy
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
System.ArgumentException

Thrown in case of an invalid parameter.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.InvalidOperationException

Thrown in case of any internal error.

API Level: 8
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.set
View Source

CreateAlarm(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
C#
Copy
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
System.ArgumentException

Thrown in case of an invalid parameter.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.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 Source

CreateAlarm(Int32, AppControl)

Sets an alarm to be triggered after a specific time. The alarm will go off delay seconds later.

Declaration
C#
Copy
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
System.ArgumentException

Thrown in case of an invalid parameter.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.InvalidOperationException

Thrown in case of any internal error.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.set
View Source

CreateAlarm(Int32, Notification)

Sets a notification alarm to be triggered after a specific time. The alarm will go off delay seconds later.

Declaration
C#
Copy
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
System.ArgumentException

Thrown in case of an invalid parameter.

UnauthorizedAccessException

Thrown in case of a permission denied.

System.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 Source

GetAllScheduledAlarms()

Retrieves all registered alarms.

Declaration
C#
Copy
public static IEnumerable<Alarm> GetAllScheduledAlarms()
Returns
Type Description
System.Collections.Generic.IEnumerable<Alarm>

List of all alarm instances.

Exceptions
Type Condition
UnauthorizedAccessException

Thrown in case of a permission denied.

System.InvalidOperationException

Thrown in case of any internal error.

API Level: 4
Privilege Level: public
Privilege: http://tizen.org/privilege/alarm.get
View Source

GetCurrentTime()

Gets the current system time.

Declaration
C#
Copy
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.

API Level: 3