Class Alarm
Class defined in:alarm-api.js:9
An Alarm.
Alarm
(
)
alarm-api.js:9
Example
var date = new Date();
<set a valid date in the future>
var api = external.getUnityObject('1.0');
api.AlarmApi.api.createAndSaveAlarmFor(
date,
api.AlarmApi.AlarmType.OneTime,
api.AlarmApi.AlarmDayOfWeek.AutoDetect,
"alarm triggered",
function(errorid) {
console.log(api.AlarmApi.api.errorToMessage(errorid));
});
daysOfWeek
( callback
)
alarm-api.js:180
Retrieves the alarm day of the week.
The property holds the days of the week the alarm is scheduled. This property can have only one day set for one time alarms and multiple days for repeating alarms.
Parameters:-
callback
<Function(AlarmType)>
enabled
( callback
)
alarm-api.js:74
Retrieves the alarm's enabled state.
The property specifies whether the alarm is enabled or not. Disable dalarms are not scheduled. The default value is true
Parameters:-
callback
<Function(Boolean)>
error
( callback
)
alarm-api.js:37
The property holds the error code occurred during the last performed operation.
Parameters:-
callback
<Function(Error)>
error
( callback
)
alarm-api.js:47
Retrieves the alarm date.
The date property holds the date the alarm will be triggered. The default value is the current date and time the alarm object was created. Further reset calls will bring the value back to the time the reset was called.
Parameters:-
callback
<Function(Date)>
message
( callback
)
alarm-api.js:97
Retrieves the alarm message.
The property holds the message string which will be displayed when the alarm is triggered. The default value is the localized "Alarm" text
Parameters:-
callback
<Function(String)>
setDate
( date, callback
)
alarm-api.js:63
Sets the alarm date.
Parameters:-
date
<Date> -
callback
<Function()>(optional) To be called after the date is set.
setDaysOfWeek
( daysOfWeek, callback
)
alarm-api.js:192
Sets the alarm day of the week.
Parameters:-
daysOfWeek
<AlarmDayOfWeek> -
callback
<Function()>(optional) To be called after the day of the week is set.
setEnabled
( enabled, callback
)
alarm-api.js:86
Sets the alarm's enabled state.
Parameters:-
enabled
<Boolean> -
callback
<Function()>(optional) To be called after the enabled state is set.
setMessage
( message, callback
)
alarm-api.js:109
Sets the alarm message.
Parameters:-
message
<String> -
callback
<Function()>(optional) To be called after the message is set.
setSound
( sound, callback
)
alarm-api.js:134
Sets the alarm sound.
Parameters:-
sound
<String> -
callback
<Function()>(optional) To be called after the sound is set.
setType
( type, callback
)
alarm-api.js:169
Sets the alarm type.
Parameters:-
type
<AlarmType> -
callback
<Function()>(optional) To be called after the type is set.
sound
( callback
)
alarm-api.js:120
Retrieves the alarm sound.
The property holds the alarm's sound to be played when the alarm is triggered. An empty url will mean to play the default sound.
The default value is an empty url.
Parameters:-
callback
<Function(String)>
status
( callback
)
alarm-api.js:145
Retrieves the alarm status.
The property holds the status of the last performed operation
Parameters:-
callback
<Function(String)>
type
( callback
)
alarm-api.js:157
Retrieves the alarm type.
The property holds the type of the alarm. The default value is AlarmType.OneTime
Parameters:-
callback
<Function(AlarmType)>