Class PushNotificationService

java.lang.Object
com.bitheads.braincloud.services.PushNotificationService

public class PushNotificationService
extends Object
  • Constructor Details

    • PushNotificationService

      public PushNotificationService​(BrainCloudClient client)
  • Method Details

    • deregisterAllPushNotificationDeviceTokens

      public void deregisterAllPushNotificationDeviceTokens​(IServerCallback callback)
      Deregisters all device tokens currently registered to the player.
      Parameters:
      callback - The method to be invoked when the server response is received
    • deregisterPushNotificationDeviceToken

      public void deregisterPushNotificationDeviceToken​(Platform platform, String token, IServerCallback callback)
      Deregisters the given device token from the server to disable this device from receiving push notifications.
      Parameters:
      platform - The device platform being deregistered.
      token - The platform-dependant device token needed for push notifications.
      callback - The method to be invoked when the server response is received
    • registerPushNotificationToken

      public void registerPushNotificationToken​(Platform platform, String token, IServerCallback callback)
      Registers the given device token with the server to enable this device to receive push notifications.
      Parameters:
      platform - The device platform
      token - The platform-dependant device token needed for push notifications.
      callback - The method to be invoked when the server response is received
    • sendSimplePushNotification

      public void sendSimplePushNotification​(String toProfileId, String message, IServerCallback callback)
      Sends a simple push notification based on the passed in message. NOTE: It is possible to send a push notification to oneself.
      Parameters:
      toProfileId - The braincloud profileId of the user to receive the notification
      message - Text of the push notification
      callback - The method to be invoked when the server response is received
    • sendRichPushNotification

      public void sendRichPushNotification​(String toProfileId, int notificationTemplateId, IServerCallback callback)
      Sends a notification to a user based on a brainCloud portal configured notification template. NOTE: It is possible to send a push notification to oneself.
      Parameters:
      toProfileId - The braincloud profileId of the user to receive the notification
      notificationTemplateId - Id of the notification template
      callback - The method to be invoked when the server response is received
    • sendRichPushNotificationWithParams

      public void sendRichPushNotificationWithParams​(String toProfileId, int notificationTemplateId, String substitutionJson, IServerCallback callback)
      Sends a notification to a user based on a brainCloud portal configured notification template. Includes JSON defining the substitution params to use with the template. See the Portal documentation for more info. NOTE: It is possible to send a push notification to oneself.
      Parameters:
      toProfileId - The braincloud profileId of the user to receive the notification
      notificationTemplateId - Id of the notification template
      substitutionJson - JSON defining the substitution params to use with the template
      callback - The method to be invoked when the server response is received
    • sendTemplatedPushNotificationToGroup

      public void sendTemplatedPushNotificationToGroup​(String groupId, int notificationTemplateId, String substitutionsJson, IServerCallback callback)
      Sends a notification to a "group" of user based on a brainCloud portal configured notification template. Includes JSON defining the substitution params to use with the template. See the Portal documentation for more info.
      Parameters:
      groupId - Target group
      notificationTemplateId - Template to use
      substitutionsJson - Map of substitution positions to strings
      callback - The method to be invoked when the server response is received
    • sendNormalizedPushNotificationToGroup

      public void sendNormalizedPushNotificationToGroup​(String groupId, String alertContentJson, String customDataJson, IServerCallback callback)
      Sends a notification to a "group" of user consisting of alert content and custom data. See the Portal documentation for more info.
      Parameters:
      groupId - Target group
      alertContentJson - Body and title of alert
      customDataJson - Optional custom data
      callback - The method to be invoked when the server response is received
    • scheduleRawPushNotificationUTC

      public void scheduleRawPushNotificationUTC​(String profileId, String fcmContent, String iosContent, String facebookContent, long startTimeUTC, IServerCallback callback)
      Schedules raw notifications based on user local time.
      Parameters:
      profileId - The profileId of the user to receive the notification
      fcmContent - Valid Fcm data content
      iosContent - Valid ios data content
      facebookContent - Facebook template string
      startTimeUTC - Start time of sending the push notification - in UTC milliseconds
      callback - The method to be invoked when the server response is received
    • scheduleRawPushNotificationMinutes

      public void scheduleRawPushNotificationMinutes​(String profileId, String fcmContent, String iosContent, String facebookContent, int minutesFromNow, IServerCallback callback)
      Schedules raw notifications based on user local time.
      Parameters:
      profileId - The profileId of the user to receive the notification
      fcmContent - Valid Fcm data content
      iosContent - Valid ios data content
      facebookContent - Facebook template string
      minutesFromNow - Minutes from now to send the push notification
      callback - The method to be invoked when the server response is received
    • sendRawPushNotification

      public void sendRawPushNotification​(String toProfileId, String fcmContent, String iosContent, String facebookContent, IServerCallback callback)
      Sends a raw push notification to a target user.
      Parameters:
      toProfileId - The profileId of the user to receive the notification
      fcmContent - Valid Fcm data content
      iosContent - Valid ios data content
      facebookContent - Facebook template string
      callback - The method to be invoked when the server response is received
    • sendRawPushNotificationBatch

      public void sendRawPushNotificationBatch​(String[] profileIds, String fcmContent, String iosContent, String facebookContent, IServerCallback callback)
      Sends a raw push notification to a target list of users.
      Parameters:
      profileIds - Collection of profile IDs to send the notification to
      fcmContent - Valid Fcm data content
      iosContent - Valid ios data content
      facebookContent - Facebook template string
      callback - The method to be invoked when the server response is received
    • sendRawPushNotificationToGroup

      public void sendRawPushNotificationToGroup​(String groupId, String fcmContent, String iosContent, String facebookContent, IServerCallback callback)
      Sends a raw push notification to a target group.
      Parameters:
      groupId - Target group
      fcmContent - Valid Fcm data content
      iosContent - Valid ios data content
      facebookContent - Facebook template string
      callback - The method to be invoked when the server response is received
    • scheduleNormalizedPushNotificationUTC

      public void scheduleNormalizedPushNotificationUTC​(String profileId, String alertContentJson, String customDataJson, long startTimeUTC, IServerCallback callback)
      Schedules a normalized push notification to a user
      Parameters:
      profileId - The profileId of the user to receive the notification
      alertContentJson - Body and title of alert
      customDataJson - Optional custom data
      startTimeUTC - Start time of sending the push notification - in UTC miliseconds
      callback - The method to be invoked when the server response is received
    • scheduleNormalizedPushNotificationMinutes

      public void scheduleNormalizedPushNotificationMinutes​(String profileId, String alertContentJson, String customDataJson, int minutesFromNow, IServerCallback callback)
      Schedules a normalized push notification to a user
      Parameters:
      profileId - The profileId of the user to receive the notification
      alertContentJson - Body and title of alert
      customDataJson - Optional custom data
      minutesFromNow - Minutes from now to send the push notification
      callback - The method to be invoked when the server response is received
    • scheduleRichPushNotificationUTC

      public void scheduleRichPushNotificationUTC​(String profileId, int notificationTemplateId, String substitutionsJson, long startTimeUTC, IServerCallback callback)
      Schedules a rich push notification to a user
      Parameters:
      profileId - The profileId of the user to receive the notification
      notificationTemplateId - Body and title of alert
      substitutionsJson - Map of substitution positions to strings
      startTimeUTC - Start time of sending the push notification - in UTC milliseconds
      callback - The method to be invoked when the server response is received
    • scheduleRichPushNotificationMinutes

      public void scheduleRichPushNotificationMinutes​(String profileId, int notificationTemplateId, String substitutionsJson, int minutesFromNow, IServerCallback callback)
      Schedules a rich push notification to a user
      Parameters:
      profileId - The profileId of the user to receive the notification
      notificationTemplateId - Body and title of alert
      substitutionsJson - Map of substitution positions to strings
      minutesFromNow - Minutes from now to send the push notification
      callback - The method to be invoked when the server response is received
    • sendNormalizedPushNotification

      public void sendNormalizedPushNotification​(String toProfileId, String alertContentJson, String customDataJson, IServerCallback callback)
      Sends a notification to a user consisting of alert content and custom data.
      Parameters:
      toProfileId - The profileId of the user to receive the notification
      alertContentJson - Body and title of alert
      customDataJson - Optional custom data
      callback - The method to be invoked when the server response is received
    • sendNormalizedPushNotificationBatch

      public void sendNormalizedPushNotificationBatch​(String[] profileIds, String alertContentJson, String customDataJson, IServerCallback callback)
      Sends a notification to multiple users consisting of alert content and custom data.
      Parameters:
      profileIds - Collection of profile IDs to send the notification to
      alertContentJson - Body and title of alert
      customDataJson - Optional custom data
      callback - The method to be invoked when the server response is received