Installation

Parse. Installation

Parse.Installation is a local representation of installation data that can be saved and retrieved from the Parse cloud. This class is a subclass of a Parse.Object, and retains the same functionality of a Parse.Object, but also extends it with installation-specific features.

A valid Parse.Installation can only be instantiated via Parse.Installation.currentInstallation()

Parse.Installation objects which have a valid deviceToken and are saved to the Parse cloud can be used to target push notifications.

Constructor

new Installation(attributes)

Parameters:
Name Type Description
attributes object

The initial set of data to store in the object.

Members

(static) DEVICE_TYPES

Returns the device types for used for Push Notifications.

Parse.Installation.DEVICE_TYPES.IOS
Parse.Installation.DEVICE_TYPES.MACOS
Parse.Installation.DEVICE_TYPES.TVOS
Parse.Installation.DEVICE_TYPES.FCM
Parse.Installation.DEVICE_TYPES.ANDROID
Parse.Installation.DEVICE_TYPES.WEB
Properties:
Name Type Description
DEVICE_TYPES object

(static) GCMSenderId

Gets the GCM sender identifier for this installation

Properties:
Name Type Description
GCMSenderId string

(static) appIdentifier

A unique identifier for this installation’s client application. In iOS, this is the Bundle Identifier.

Properties:
Name Type Description
appIdentifier string

(static) appName

The display name of the client application to which this installation belongs.

Properties:
Name Type Description
appName string

(static) appVersion

The version string of the client application to which this installation belongs.

Properties:
Name Type Description
appVersion string

(static) badge

The current value of the icon badge for iOS apps. Changes to this value on the server will be used for future badge-increment push notifications.

Properties:
Name Type Description
badge number

(static) channels

An array of the channels to which a device is currently subscribed.

Properties:
Name Type Description
channels Array.<string>

(static) deviceToken

Token used to deliver push notifications to the device.

Properties:
Name Type Description
deviceToken string

(static) deviceType

The type of device, “ios”, “android”, “web”, etc.

Properties:
Name Type Description
deviceType string

(static) installationId

Universally Unique Identifier (UUID) for the device used by Parse. It must be unique across all of an app’s installations.

Properties:
Name Type Description
installationId string

(static) localeIdentifier

Gets the local identifier for this installation

Properties:
Name Type Description
localeIdentifier string

(static) parseVersion

Gets the parse server version for this installation

Properties:
Name Type Description
parseVersion string

(static) pushType

This field is reserved for directing Parse to the push delivery network to be used.

Properties:
Name Type Description
pushType string

(static) timeZone

Gets the time zone for this installation

Properties:
Name Type Description
timeZone string

Methods

(async) fetch(…args) → {Promise}

Wrap the default fetch behavior with functionality to update local storage. If the installation is deleted on the server, retry the fetch as a save operation.

Parameters:
Name Type Attributes Description
args any <repeatable>
Returns:
Type:
Promise

(async) save(…args) → {Promise}

Wrap the default save behavior with functionality to update the local storage. If the installation is deleted on the server, retry saving a new installation.

Parameters:
Name Type Attributes Description
args any <repeatable>
Returns:
Type:
Promise

(static) currentInstallation() → {Promise}

Get the current Parse.Installation from disk. If doesn't exists, create an new installation.

const installation = await Parse.Installation.currentInstallation();
installation.set('deviceToken', '123');
await installation.save();
Returns:
Type:
Promise

A promise that resolves to the local installation object.