Package com.bitheads.braincloud.services
Class PushNotificationService
java.lang.Object
com.bitheads.braincloud.services.PushNotificationService
public class PushNotificationService extends Object
-
Constructor Summary
Constructors Constructor Description PushNotificationService(BrainCloudClient client) -
Method Summary
Modifier and Type Method Description voidderegisterAllPushNotificationDeviceTokens(IServerCallback callback)Deregisters all device tokens currently registered to the player.voidderegisterPushNotificationDeviceToken(Platform platform, String token, IServerCallback callback)Deregisters the given device token from the server to disable this device from receiving push notifications.voidregisterPushNotificationToken(Platform platform, String token, IServerCallback callback)Registers the given device token with the server to enable this device to receive push notifications.voidscheduleNormalizedPushNotificationMinutes(String profileId, String alertContentJson, String customDataJson, int minutesFromNow, IServerCallback callback)Schedules a normalized push notification to a uservoidscheduleNormalizedPushNotificationUTC(String profileId, String alertContentJson, String customDataJson, long startTimeUTC, IServerCallback callback)Schedules a normalized push notification to a uservoidscheduleRawPushNotificationMinutes(String profileId, String fcmContent, String iosContent, String facebookContent, int minutesFromNow, IServerCallback callback)Schedules raw notifications based on user local time.voidscheduleRawPushNotificationUTC(String profileId, String fcmContent, String iosContent, String facebookContent, long startTimeUTC, IServerCallback callback)Schedules raw notifications based on user local time.voidscheduleRichPushNotificationMinutes(String profileId, int notificationTemplateId, String substitutionsJson, int minutesFromNow, IServerCallback callback)Schedules a rich push notification to a uservoidscheduleRichPushNotificationUTC(String profileId, int notificationTemplateId, String substitutionsJson, long startTimeUTC, IServerCallback callback)Schedules a rich push notification to a uservoidsendNormalizedPushNotification(String toProfileId, String alertContentJson, String customDataJson, IServerCallback callback)Sends a notification to a user consisting of alert content and custom data.voidsendNormalizedPushNotificationBatch(String[] profileIds, String alertContentJson, String customDataJson, IServerCallback callback)Sends a notification to multiple users consisting of alert content and custom data.voidsendNormalizedPushNotificationToGroup(String groupId, String alertContentJson, String customDataJson, IServerCallback callback)Sends a notification to a "group" of user consisting of alert content and custom data.voidsendRawPushNotification(String toProfileId, String fcmContent, String iosContent, String facebookContent, IServerCallback callback)Sends a raw push notification to a target user.voidsendRawPushNotificationBatch(String[] profileIds, String fcmContent, String iosContent, String facebookContent, IServerCallback callback)Sends a raw push notification to a target list of users.voidsendRawPushNotificationToGroup(String groupId, String fcmContent, String iosContent, String facebookContent, IServerCallback callback)Sends a raw push notification to a target group.voidsendRichPushNotification(String toProfileId, int notificationTemplateId, IServerCallback callback)Sends a notification to a user based on a brainCloud portal configured notification template.voidsendRichPushNotificationWithParams(String toProfileId, int notificationTemplateId, String substitutionJson, IServerCallback callback)Sends a notification to a user based on a brainCloud portal configured notification template.voidsendSimplePushNotification(String toProfileId, String message, IServerCallback callback)Sends a simple push notification based on the passed in message.voidsendTemplatedPushNotificationToGroup(String groupId, int notificationTemplateId, String substitutionsJson, IServerCallback callback)Sends a notification to a "group" of user based on a brainCloud portal configured notification template.
-
Constructor Details
-
PushNotificationService
-
-
Method Details
-
deregisterAllPushNotificationDeviceTokens
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 platformtoken- 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 notificationmessage- Text of the push notificationcallback- 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 notificationnotificationTemplateId- Id of the notification templatecallback- 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 notificationnotificationTemplateId- Id of the notification templatesubstitutionJson- JSON defining the substitution params to use with the templatecallback- 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 groupnotificationTemplateId- Template to usesubstitutionsJson- Map of substitution positions to stringscallback- 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 groupalertContentJson- Body and title of alertcustomDataJson- Optional custom datacallback- 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 notificationfcmContent- Valid Fcm data contentiosContent- Valid ios data contentfacebookContent- Facebook template stringstartTimeUTC- Start time of sending the push notification - in UTC millisecondscallback- 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 notificationfcmContent- Valid Fcm data contentiosContent- Valid ios data contentfacebookContent- Facebook template stringminutesFromNow- Minutes from now to send the push notificationcallback- 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 notificationfcmContent- Valid Fcm data contentiosContent- Valid ios data contentfacebookContent- Facebook template stringcallback- 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 tofcmContent- Valid Fcm data contentiosContent- Valid ios data contentfacebookContent- Facebook template stringcallback- 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 groupfcmContent- Valid Fcm data contentiosContent- Valid ios data contentfacebookContent- Facebook template stringcallback- 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 notificationalertContentJson- Body and title of alertcustomDataJson- Optional custom datastartTimeUTC- Start time of sending the push notification - in UTC milisecondscallback- 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 notificationalertContentJson- Body and title of alertcustomDataJson- Optional custom dataminutesFromNow- Minutes from now to send the push notificationcallback- 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 notificationnotificationTemplateId- Body and title of alertsubstitutionsJson- Map of substitution positions to stringsstartTimeUTC- Start time of sending the push notification - in UTC millisecondscallback- 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 notificationnotificationTemplateId- Body and title of alertsubstitutionsJson- Map of substitution positions to stringsminutesFromNow- Minutes from now to send the push notificationcallback- 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 notificationalertContentJson- Body and title of alertcustomDataJson- Optional custom datacallback- 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 toalertContentJson- Body and title of alertcustomDataJson- Optional custom datacallback- The method to be invoked when the server response is received
-