public class

AlertsManagerImpl

extends Object
implements AlertsManager
java.lang.Object
   ↳ com.mapsted.alerts.AlertsManagerImpl

Class Overview

AlertsManager class is used to get alerts for a property. It also provides callbacks for alerts which should be activated based on user position transition in the property. Use Mapsted Hub dashboard to setup the alerts for your property.

Summary

Nested Classes
interface AlertsManagerImpl.UserAtLocationCallback Callback for scheduled alert triggers when user is at the location. 
Public Methods
void fetchAlertsByAlertIds(List<String> alertIds, Consumer<List<BaseAlert>> callback)
Use this method to get scheduled and emergency alerts from local db if you have the alertIds.
List<BaseAlert> fetchAlertsByAlertIds(List<String> alertIds)
Use this method to get the scheduled and emergency alert objects from local db if you have the alertIds.
void fetchEmergencyAlerts(int propertyId, Consumer<List<EmergencyAlert>> callback)
Get emergency alerts for a property
void fetchScheduledAlertsById(String alertId, Consumer<ScheduledAlert> callback)
Use this method to get the scheduled alert object if you have the alertId.
synchronized static AlertsManager getInstance(Context context, CoreApi coreApi)
Get the singleton AlertManager
List<ScheduledAlert> getOngoingAlertsForEntity(int propertyId, int buildingId, int floorId, int entityId)
Get ongoing or active scheduled alerts for an entity.
List<ScheduledAlert> getOngoingAlertsForProperty(int propertyId)
Get ongoing scheduled alerts at a property.
void onDestroy()
Call onDestroy when your application exits.
void registerListener(AlertsOnChangeListener alertsOnChangeListener)
Register onChangeListener for property user is interested in but not necessarily at the property.
void sendFirebaseTokenForEmergencyAlerts(Context appContext, CoreApi coreApi, String token)
Use this to send firebase token to receive emergency alerts via firebase messaging service.
void setUserAtLocationCallback(AlertsManagerImpl.UserAtLocationCallback userAtLocationCallback)
Set callback for when scheduled alerts triggers while the user is at a property.
void unregisterListener(AlertsOnChangeListener alertsOnChangeListener)
Unregister a previously registered callback.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.mapsted.alerts.AlertsManager

Public Methods

public void fetchAlertsByAlertIds (List<String> alertIds, Consumer<List<BaseAlert>> callback)

Use this method to get scheduled and emergency alerts from local db if you have the alertIds. BaseAlert can be ScheduledAlert or EmergencyAlert.

Parameters
alertIds input parameter
callback callback for result

public List<BaseAlert> fetchAlertsByAlertIds (List<String> alertIds)

Use this method to get the scheduled and emergency alert objects from local db if you have the alertIds. BaseAlert can be ScheduledAlert or EmergencyAlert.

Returns
  • list of base alerts

public void fetchEmergencyAlerts (int propertyId, Consumer<List<EmergencyAlert>> callback)

Get emergency alerts for a property

Parameters
propertyId property id
callback callback with result

public void fetchScheduledAlertsById (String alertId, Consumer<ScheduledAlert> callback)

Use this method to get the scheduled alert object if you have the alertId.

Parameters
alertId alert id
callback callback for result

public static synchronized AlertsManager getInstance (Context context, CoreApi coreApi)

Get the singleton AlertManager

Parameters
coreApi an initialized coreApi

public List<ScheduledAlert> getOngoingAlertsForEntity (int propertyId, int buildingId, int floorId, int entityId)

Get ongoing or active scheduled alerts for an entity.

Parameters
propertyId entity's propertyId
buildingId entity's buildingId
floorId entity's floorId
entityId entity's id
Returns
  • list of scheduled alerts

public List<ScheduledAlert> getOngoingAlertsForProperty (int propertyId)

Get ongoing scheduled alerts at a property.

Parameters
propertyId property id
Returns
  • list of scheduled alerts

public void onDestroy ()

Call onDestroy when your application exits.

public void registerListener (AlertsOnChangeListener alertsOnChangeListener)

Register onChangeListener for property user is interested in but not necessarily at the property.

public void sendFirebaseTokenForEmergencyAlerts (Context appContext, CoreApi coreApi, String token)

Use this to send firebase token to receive emergency alerts via firebase messaging service. You must create a service by extending EmergencyAlertsFirebaseMessagingService

Parameters
appContext app context
token firebaseToken

public void setUserAtLocationCallback (AlertsManagerImpl.UserAtLocationCallback userAtLocationCallback)

Set callback for when scheduled alerts triggers while the user is at a property. You can show this to user using MapstedInAppNotificationsApi

Parameters
userAtLocationCallback callback with the ScheduledAlert that got triggered.

public void unregisterListener (AlertsOnChangeListener alertsOnChangeListener)

Unregister a previously registered callback.