Home Reference Source
public class | source

PushContainer

Push container

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get

deviceID: String: *

The device ID

Method Summary

Public Methods
public

async registerDevice(token: string, type: string, topic: string): *

You can register your device for receiving push notifications.

public

async sendToDevice(devices: string | string[], notification: Object, topic: string): Object[]

Send a push notification to specified devices.

public

async sendToUser(users: string | string[], notification: Object, topic: string): Object[]

Send a push notification to all devices associated with the specified users.

public

async unregisterDevice(): *

Unregisters the current user from the current device.

Public Constructors

public constructor(container: Container): PushContainer source

Params:

NameTypeAttributeDescription
container Container

the Skygear container

Return:

PushContainer

Public Members

public get deviceID: String: * source

The device ID

Return:

String

Public Methods

public async registerDevice(token: string, type: string, topic: string): * source

You can register your device for receiving push notifications.

Params:

NameTypeAttributeDescription
token string

the device token

type string

the device type (either 'ios' or 'android')

topic string

the device topic, refer to application bundle identifier on iOS and application package name on Android

Return:

*

public async sendToDevice(devices: string | string[], notification: Object, topic: string): Object[] source

Send a push notification to specified devices.

Params:

NameTypeAttributeDescription
devices string | string[]

a list of Device IDs

notification Object

push notification payload

notification.apns Object

push notification payload for APNS

notification.gcm Object

push notification payload for GCM

topic string
  • nullable: true

the device topic, refer to application bundle identifier on iOS and application package name on Android

Return:

Object[]

list of users to which notification was sent

See:

public async sendToUser(users: string | string[], notification: Object, topic: string): Object[] source

Send a push notification to all devices associated with the specified users.

Params:

NameTypeAttributeDescription
users string | string[]

a list of User IDs

notification Object

push notification payload

notification.apns Object

push notification payload for APNS

notification.gcm Object

push notification payload for GCM

topic string
  • nullable: true

the device topic, refer to application bundle identifier on iOS and application package name on Android

Return:

Object[]

list of users to which notification was sent

See:

public async unregisterDevice(): * source

Unregisters the current user from the current device. This should be called when the user logouts.

Return:

*