Skip to content
Mark Taylor edited this page Apr 1, 2014 · 7 revisions

addAlarm(what, when, showOption, extras, successCallback, failureCallback)

Allows you to add a new alarm

Parameters

  • what - String - the fully qualified classname of the Android Activity to be started on the alarm. Note that the helper function [getDefaultClass] (getDefaultClass) can be used to return the current activity.
  • when - Date object - JavaScript Date object of when the alarm should be triggered. This should be in local timezone, the plugin will automatically convert and store as UTC.
  • extras - JSON Object - Allows you to provide user defined values that will be passed to the Activity that is started as a result of the Alarm. The alarm Activity can retrieve the "extras" data using the [getActivityExtras] (getActivityExtras) method.
  • showOption - String - Show Option controls how the alarm will display. See [ShowOption] (ShowOption) for possible values.
  • successCallback - function - The callback which will be called if the method is successful. The callback is passed the output (see below).
  • failureCallback - function - The callback which will be called if the method encounters an error. The callback is passed the output (see below).

Output

On success, the provided JSONObject will contain:

  • id - integer - ID of the alarm
  • when - String - the fully qualified classname of the Android Activity to be started on the alarm.
  • when - Date object - JavaScript Date object of when the alarm should be triggered. While this is stores internally as UTC, it will automatically be converted to local timezone.
  • showOption - String - Show Option controls how the alarm will display. See [ShowOption] (ShowOption) for possible values.
  • extras - JSON Object - User defined values that will be passed to the Activity that is started as a result of the Alarm.

On failure, the provided JSONObject will contain:

  • ErrorMessage - string - A textual description on why the function failed.

Also see

  • [getDefaultClass] (getDefaultClass)
  • [ShowOption] (ShowOption)
  • [getActivityExtras] (getActivityExtras)
Clone this wiki locally