Package org.ametys.plugins.mobileapp
Class PushNotificationManager
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.mobileapp.PushNotificationManager
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class PushNotificationManager extends AbstractLogEnabled implements Serviceable, Component
manager to push notifications to users
-
-
Field Summary
Fields Modifier and Type Field Description protected UserPreferencesHelper
_userPreferencesHelper
User Preferences Helperstatic String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description PushNotificationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_handlePushError(io.github.jav.exposerversdk.PushNotificationException exception, String title, String message, Map<String,Object> data)
Handle an exception essentially when trying to push notifications to multiple projects, to do it again for each projectvoid
pushNotifications(String title, String message, Set<String> tokens, Map<String,Object> data)
Push a notification to a list of registered devicesvoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_userPreferencesHelper
protected UserPreferencesHelper _userPreferencesHelper
User Preferences Helper
-
-
Constructor Detail
-
PushNotificationManager
public PushNotificationManager()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
pushNotifications
public void pushNotifications(String title, String message, Set<String> tokens, Map<String,Object> data) throws io.github.jav.exposerversdk.PushClientException
Push a notification to a list of registered devices- Parameters:
title
- title of the messagemessage
- message to sendtokens
- list of devicet tokensdata
- the data to push- Throws:
io.github.jav.exposerversdk.PushClientException
- something went wrong
-
_handlePushError
protected void _handlePushError(io.github.jav.exposerversdk.PushNotificationException exception, String title, String message, Map<String,Object> data) throws io.github.jav.exposerversdk.PushClientException
Handle an exception essentially when trying to push notifications to multiple projects, to do it again for each project- Parameters:
exception
- the exception throwntitle
- title of the notificationmessage
- description of the notificationdata
- data of the notification- Throws:
io.github.jav.exposerversdk.PushClientException
- Something went very wrong
-
-