use of org.onebusaway.api.services.apns.ApplePushNotificationService in project onebusaway-application-modules by camsys.
the class AlarmServiceImpl method fireAlarm.
@Override
public void fireAlarm(String alarmId) {
AlarmDetails details = _alarmsById.remove(alarmId);
if (details == null)
return;
if (details instanceof ApnsAlarmDetails) {
ApnsAlarmDetails apnsDetails = (ApnsAlarmDetails) details;
JSONObject data = getDataAsJson(apnsDetails.getData());
String payload = getDataAsApnsPayload(alarmId, data);
boolean isProduction = isProduction(data);
for (ApplePushNotificationService service : _applePushNotificationServices) {
if (service.isProduction() == isProduction) {
service.pushNotification(apnsDetails.getDeviceToken(), payload);
return;
}
}
_log.warn("no appropriate ApplePushNotificationService found for alarm: production=" + isProduction);
}
}
Aggregations