MpnDevice class
Class representing a device that supports Mobile Push Notifications (MPN).
It contains device details and the listener needed to monitor its status.
An MPN device is created from the application context, the sender ID (a.k.a. authorized entity) and a device token (a.k.a. registration token) obtained from
Firebase Cloud Messaging APIs, and must be registered on the LightstreamerClient in order to successfully subscribe an MPN subscription.
See MpnSubscription.
After creation, an MpnDevice object is in "unknown" state. It must then be passed to the Lightstreamer Server with the
LightstreamerClient.registerForMpn
method, which enables the client to subscribe MPN subscriptions and sends the device details to the
server's MPN Module, where it is assigned a permanent device ID and its state is switched to "registered".
Upon registration on the server, active MPN subscriptions of the device are received and exposed with the LightstreamerClient.getMpnSubscriptions
method.
An MpnDevice's state may become "suspended" if errors occur during push notification delivery. In this case MPN subscriptions stop sending notifications
and the device state is reset to "registered" at the first subsequent registration.
- Available extensions
- Annotations
-
- @JS()
- @staticInterop
Constructors
- MpnDevice.new(String token, String appId, String platform)
-
Creates an object to be used to describe an MPN device that is going to be registered to the MPN Module of Lightstreamer Server.
*
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
MpnDeviceListener listener) → void -
Available on MpnDevice, provided by the MpnDeviceExt extension
Adds a listener that will receive events from the MPN device object. -
getApplicationId(
) → String -
Available on MpnDevice, provided by the MpnDeviceExt extension
The application ID of this MPN device, corresponding to the package name of the application. In the MpnDevice implementation it is determined automatically from the Application Context during creation and is used by the server as part of the device identification. -
getDeviceId(
) → String? -
Available on MpnDevice, provided by the MpnDeviceExt extension
The server-side unique persistent ID of the device. -
getDeviceToken(
) → String -
Available on MpnDevice, provided by the MpnDeviceExt extension
The device token of this MPN device. -
getListeners(
) → List< MpnDeviceListener> -
Available on MpnDevice, provided by the MpnDeviceExt extension
List containing the MpnDeviceListener instances that were added to this MPN device object. -
getPlatform(
) → String -
Available on MpnDevice, provided by the MpnDeviceExt extension
The platform identifier of this MPN device. -
getPreviousDeviceToken(
) → String? -
Available on MpnDevice, provided by the MpnDeviceExt extension
The previous device token of this MPN device. -
getStatus(
) → String -
Available on MpnDevice, provided by the MpnDeviceExt extension
The status of the device. -
getStatusTimestamp(
) → int -
Available on MpnDevice, provided by the MpnDeviceExt extension
The server-side timestamp of the device status. -
isRegistered(
) → bool -
Available on MpnDevice, provided by the MpnDeviceExt extension
Checks whether the MPN device object is currently registered on the server or not. -
isSuspended(
) → bool -
Available on MpnDevice, provided by the MpnDeviceExt extension
Checks whether the MPN device object is currently suspended on the server or not. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeListener(
MpnDeviceListener listener) → void -
Available on MpnDevice, provided by the MpnDeviceExt extension
Removes a listener from the MPN device object so that it will not receive events anymore. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited