Class MpnDevice
java.lang.Object
com.lightstreamer.client.mpn.AbstractMpnDevice
com.lightstreamer.client.mpn.android.MpnDevice
- All Implemented Interfaces:
MpnDeviceInterface
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
After creation, an MpnDevice object is in "unknown" state. It must then be passed to the Lightstreamer Server with the
Upon registration on the server, active MPN subscriptions of the device are received and exposed with the
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.
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(MpnDeviceInterface)
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(String)
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.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an object to be used to describe an MPN device that is going to be registered to the MPN Module of Lightstreamer Server.
During creation the MpnDevice tries to acquires some more details: The package name, through the Application Context. Any previously registered device token, from the Shared Preferences storage. It then saves the current device token on the Shared Preferences storage. -
Method Summary
Modifier and TypeMethodDescriptionThe platform identifier of this MPN device.Methods inherited from class com.lightstreamer.client.mpn.AbstractMpnDevice
addListener, getApplicationId, getDeviceId, getDeviceToken, getListeners, getPreviousDeviceToken, getStatus, getStatusTimestamp, isRegistered, isSuspended, removeListener
-
Constructor Details
-
MpnDevice
Creates an object to be used to describe an MPN device that is going to be registered to the MPN Module of Lightstreamer Server.
During creation the MpnDevice tries to acquires some more details:- The package name, through the Application Context.
- Any previously registered device token, from the Shared Preferences storage.
- Parameters:
appContext
- the Application Contexttoken
- the device token- Throws:
IllegalArgumentException
- ifcontext
,senderId
ortoken
are null.
-
-
Method Details
-
getPlatform
The platform identifier of this MPN device. It equals to the constantGoogle
and is used by the server as part of the device identification.- Returns:
- the MPN device platform.
- Lifecycle:
- This method can be called at any time.
-