Module: notifications

Members

(static) config :Object

Type:
  • Object
Properties:
Name Type Description
config
Properties
Name Type Attributes Default Description
driver String <optional>
"http" The driver to use.
autoReset Boolean <optional>
true If true, set the badge count to 0 when you open/resume the application.
androidModule String <optional>
"ti.goosh" The name of the Android module to load.
fakeRemoteDeviceUUID Boolean <optional>
false Fake a device token
Source:

(static) on

Attach events to current module
Source:

(static) PushModule :Object

The module used for push notifications
Type:
  • Object
Source:

(static) PushModuleOpt :Object

The options for the registerForPushNotifications method of the push module
Type:
  • Object
Source:

Methods

(static) activate(optopt) → {Q.Promise}

Activate the notifications without a subscription to a service. You can use this method to just ask to the user the permissions.
Parameters:
Name Type Attributes Description
opt Object <optional>
Properties
Name Type Attributes Description
success function <optional>
Callback to invoke on success
Source:
Returns:
[opt.error] Callback to invoke on error
Type
Q.Promise

(static) addInteractiveNotificationCategory(id, dict, callback)

Parameters:
Name Type Description
id String The ID of the category. It must be unique.
dict Array An array of actions. Each action must have defined: `id` (required), the ID of this action `title` (required) the title to show `callback` (required) the callback that handle the user click `openApplication`, `destructive`, `authenticationRequired` are optionals.
callback function The callback to invoke
Source:

(static) deactivate()

Deactivate completely the notifications Per Apple's documentation, it is rarely necessary to call this method. For example, calling this method would be required if a new version of your application no longer supports push notifications.
Source:

(static) getBadge() → {Number}

Get the application badge number
Source:
Returns:
Type
Number

(static) getRemoteDeviceUUID() → {String}

Get the stored device token. Don't rely on this method to check if notifications are active, use #isRemoteNotificationsEnabled instead
Source:
Returns:
Type
String

(static) incBadge(value)

Increment the badge app
Parameters:
Name Type Description
value Number The value to increment
Source:

(static) isRemoteNotificationsEnabled() → {Boolean}

Check if the remote notifications has been registered once. Use this method at startup in conjunction with `activate()`
Source:
Returns:
[description]
Type
Boolean

(static) loadDriver()

Load a driver of current module
Source:

(static) mute(data)

Mute all notifications
Parameters:
Name Type Description
data Object Additional data
Source:

(static) off(name, cb)

Remove events to current module
Parameters:
Name Type Description
name String Event key
cb function Callback
Source:

(static) onReceived()

Properties:
Name Type Description
onReceived A callback called when a notification is received. You can override this to handle incoming notifications, or just listen to the global event "notifications.received"
Source:

(static) resetBadge()

Set the application badge to zero
Source:

(static) setBadge(value)

Set the application badge number
Parameters:
Name Type Description
value Number
Source:

(static) subscribe(channelopt, dataopt, optopt) → {Q.Promise}

The main method: It activate the notifications (asking to the user the permissions), and sends the device token to your driver.
Parameters:
Name Type Attributes Description
channel String <optional>
Channel name
data Object <optional>
Additional data to pass to the driver
opt Object <optional>
Additional options to pass to the driver
Source:
Returns:
Type
Q.Promise

(static) trigger(name, cb)

Trigger events from current module
Parameters:
Name Type Description
name String Event key
cb function The data
Source:

(static) unmute(data)

Unmute all notifications
Parameters:
Name Type Description
data Object Additional data
Source:

(static) unsubscribe(channelopt, dataopt, optopt) → {Q.Promise}

Unsubscribe from a channel using the specified driver.
Parameters:
Name Type Attributes Description
channel String <optional>
Channel name
data Object <optional>
Additional data to pass to the driver
opt Object <optional>
Additional options to pass to the driver
Source:
Returns:
Type
Q.Promise

(static) validateToken(token) → {Boolean}

Validate a device token using empiric methods. It only checks the the argument is a string and its length is enough for a valid token.
Parameters:
Name Type Description
token String The device token
Source:
Returns:
Type
Boolean