Class: Fcmtokens

Fcmtokens(logger)

Class represents fcmtokens in ALARMiator Core

Constructor

new Fcmtokens(logger)

Parameters:
Name Type Description
logger object logger instance to be used by this class instance.
Author:
  • Jens Dinstühler
Source:

Methods

createFCMToken(deviceId, state, pluginNamespace, predecessorTokenId, fcmToken, callback)

adds a new fcm token to core database
Parameters:
Name Type Description
deviceId integer id of device this token comes from
state integer state (1 active, 0 inactive)
pluginNamespace string namespace of plugin this tokens belongs to
predecessorTokenId integer if this is a new token for an existing (so it is replacing an old one) this is the id of the old token
fcmToken string the actal fcm token
callback function success (true or false)
Source:

doesTokenExist(fcmtoken, callback)

Checks, if a token exists in database
Parameters:
Name Type Description
fcmtoken string
callback function null or row of existing device
Source:

getAllFCMTokens(callback)

Returns all FCM Tokens from core database
Parameters:
Name Type Description
callback function rows or null
Source:

getAllFCMTokensForBasedataAndNamespace(pluginNamespace, basedataId, callback)

Returns rows with tokens for basedata and namespace
Parameters:
Name Type Description
pluginNamespace string namespace of plugin, tokens shall be returned for
basedataId * basedata id of member the tokens shall be returned for
callback * rows or null
Source:

getAllFCMTokensForNamespace(pluginNamespace, callback)

Returns all active FCM Tokens from core database for the given plugin namespace
Parameters:
Name Type Description
pluginNamespace string namespace of plugin this tokens belongs to
callback function rows or null
Source:

getAllFCMTokensForUI(callback)

Returns all FCM Tokens from core database enriched with device data for UI Listings
Parameters:
Name Type Description
callback function rows or null
Source:

getTokenWithId(id, callback)

Returns a single token given with id
Parameters:
Name Type Description
id integer tokenid
callback function rows or null
Source:

removeToken(tokenId, callback)

Removes a token from database
Parameters:
Name Type Description
tokenId integer id of token in core database
callback function success (true or false)
Source:

removeTokensForDeviceID(deviceId, callback)

Removes all tokens from store for a given device id
Parameters:
Name Type Description
deviceId integer id of device
callback function success (true/false)
Source:

removeTokensForDeviceUUID(uuid, callback)

Removes all tokens for a given uuid for a device
Parameters:
Name Type Description
uuid string
callback function success (true or false)
Source:

setActive(tokenId, callback)

Sets the state of an token to active
Parameters:
Name Type Description
tokenId integer id of token in coredatabase to set state for
callback function success (true or false)
Source:

setInactive(tokenId, callback)

Sets the state of an token to inactive
Parameters:
Name Type Description
tokenId integer id of token in coredatabase to set state for
callback function success (true or false)
Source: