Push Notifications

Push Notifications provide a way to deliver some information to users while they are not using your app actively. The following use cases can be covered additionally with push notifications:

  • send a chat message when a recipient is offline (a push notification will be initiated automatically in this case)
  • make a video call with offline opponents (need to send a push notification manually)


In order to start work with push notifications you need to configure it.

For iOS application that uses Apple Push Notifications you must have APNS certificate uploaded via the ConnectyCube Dashboard Console panel.

For Android application that uses Firebase Cloud Messaging (FCM) you need to obtain API Key and set it on ConnectyCube Dashboard Console panel.

To work with Push notifications in Flutter you can use
for example firebase_messaging lib from pub.dev repository.


In order to start receiving push notifications you need to subscribe your current device as follows:

CreateSubscriptionParameters parameters = CreateSubscriptionParameters();
parameters.environment = CubeEnvironment.DEVELOPMENT;

  parameters.channel = NotificationsChannels.GCM;
  parameters.platform = CubePlatform.ANDROID;
} else if (Platform.isIOS){
  parameters.channel = NotificationsChannels.APNS;
  parameters.platform = CubePlatform.IOS;

String deviceId = "2b6f0cc904d137be2e1730235f5664094b831186"; // some device identifier
parameters.udid = deviceId;
parameters.pushToken = "2b6f0cc9...4b831186";
parameters.bundleIdentifier = ""; // not required, a unique identifier for client's application. In iOS, this is the Bundle Identifier. In Android - package id

  .then((cubeSubscription) {})
  .catchError((error) {});

Send push notifications

You can manually initiate a push notification to user/users on any event in your application. To do so you need to form a push notification parameters (payload) and set the push recipients:

CreateEventParams params = CreateEventParams();
params.parameters = {
  'message': "Some message in push", // 'message' field is required
  'custom_parameter1': "custom parameter value 1",
  'custom_parameter2': "custom parameter value 2"

params.notificationType = NotificationType.PUSH;
params.environment = CubeEnvironment.DEVELOPMENT;
params.usersIds = [88707, 88708];

  .then((cubeEvent) {})
  .catchError((error) {});

Receive push notifications

The flow how you receive push notifications depends on what platform you use: Android, iOS or something else. For Android an iOS you can use for example firebase_messaging lib from pub.dev repository.


In order to unsubscribe and stop receiving push notifications you need to list your current subscriptions and then choose those to be deleted:

  .then((subscriptionsList) {
    int subscriptionIdToDelete = subscriptionsList[0].id; // or other subscription's id
    return deleteSubscription(subscriptionIdToDelete);
  .then((voidResult) {})
  .catchError((error) {});