public final class

PushNotificationController

extends Object
java.lang.Object
   ↳ com.vidinoti.android.vdarsdk.PushNotificationController

Class Overview

Class responsible for managing the Android push notifications. It expects FCM (Firebase Cloud Messaging). For final integration guide, see the documentation in vidinoti.github.io The notifications must be enabled via setNotificationsSupport(boolean). The application must create a FirebaseInstanceIdService class and must forward any new FCM token to the SDK via onTokenRefresh(String) (this is done via the publicly exposed method updatePushNotificationToken(String)). When a new FCM token is received, it is sent to the backend server.

Summary

Public Methods
static PushNotificationController getInstance()
Returns the singleton instance of the PushNotificationController
Protected Methods
boolean isNotificationSupportEnabled()
Returns true if the push notifications are enabled, false otherwise.
synchronized void onTokenRefresh(String token)
Updates the token and send it to the server.
void setNotificationsSupport(boolean enabled)
Sets whether the application should activate the push notifications.
void updateNotificationSupport()
Updates the notification support (sends the token to the backend server if it has not been able to do it before.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static PushNotificationController getInstance ()

Returns the singleton instance of the PushNotificationController

Returns
  • the singleton instance of the PushNotificationController

Protected Methods

protected boolean isNotificationSupportEnabled ()

Returns true if the push notifications are enabled, false otherwise.

Returns
  • true if the push notifications are enabled, false otherwise.

protected synchronized void onTokenRefresh (String token)

Updates the token and send it to the server. This method must be called by the onTokenRefresh method of the FirebaseInstanceIdService service

Parameters
token the FCM token

protected void setNotificationsSupport (boolean enabled)

Sets whether the application should activate the push notifications. When enabled, the FCM token will be sent to the backend server. When disabled, we will ensure that the backend server will remove the notification if it was present before.

Parameters
enabled true for enabling the push notifications, false otherwise.

protected void updateNotificationSupport ()

Updates the notification support (sends the token to the backend server if it has not been able to do it before.