UnifiedPush class
Class to interact with the UnifiedPush service and receive events
Initialize the receiver
When you initialize your application, register the different functions that will handle the incoming events with UnifiedPush.initialize.
Register for push messages
If a distributor is already saved (if getDistributor is not null), you should register directly.
Else, use getDistributors to get the list of installed distributors, and ask the users which one they would like to use. You can then save their choice with saveDistributor, and register.
Unregister
A registration can be canceled with unregister
Embed a distributor
On Android, this is possible to embed a distributor that will register to the Google play services directly. For more information refer to unifiedpush.org/kdoc/embedded_fcm_distributor/
Send push messages
You can then send web push messages to your applications. The messages need to be encrypted. The required information them are retrieved onNewEndpoint: PushEndpoint.pubKeySet
Constructors
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getDistributor(
) → Future< String?> - Returns the qualified identifier of the distributor used.
-
getDistributors(
[List< String> ? features = const []]) → Future<List< String> > - Returns the qualified identifier of all available distributors on the system.
-
initialize(
{void onNewEndpoint(PushEndpoint endpoint, String instance)?, void onRegistrationFailed(FailedReason reason, String instance)?, void onUnregistered(String instance)?, void onMessage(PushMessage message, String instance)?, String? linuxDBusName}) → Future< bool> - Initialize the different event listener.
-
register(
{String instance = defaultInstance, List< String> ? features = const [], String? messageForDistributor, String? vapid}) → Future<void> - Register the app to the saved distributor with a specified token identified with the instance parameter This method needs to be called at every app startup with the same distributor and token.
-
registerApp(
[String instance = defaultInstance, List< String> ? features = const []]) → Future<void> -
saveDistributor(
String distributor) → Future< void> - Save the distributor to be used.
-
tryUseCurrentOrDefaultDistributor(
) → Future< bool> - Try to use the saved distributor else, use the default distributor of the system
-
unregister(
[String instance = defaultInstance]) → Future< void> - Send an unregistration request for the instance to the saved distributor and remove the registration. Remove the distributor if this is the last instance registered.