use of sugar.free.sightparser.applayer.descriptors.alerts.Error7ElectronicError in project SightRemote by TebbeUbben.
the class AlertService method onResult.
@Override
public void onResult(Object result) {
if (result instanceof ActiveAlertMessage) {
ActiveAlertMessage activeAlertMessage = (ActiveAlertMessage) result;
if (activeAlertMessage.getAlert() instanceof Error7ElectronicError) {
serviceConnector.disconnect();
return;
}
Alert alert = activeAlertMessage.getAlert();
if (alert == null) {
serviceConnector.disconnect();
return;
} else
serviceConnector.connect();
if (latestId != activeAlertMessage.getAlertID()) {
if (alertActivity != null)
alertActivity.finish();
if (activeAlertMessage.getAlertStatus() == AlertStatus.MUTED)
return;
latestId = activeAlertMessage.getAlertID();
Intent intent = new Intent(this, AlertActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("alertMessage", SerializationUtils.serialize(activeAlertMessage));
startActivity(intent);
Answers.getInstance().logCustom(new CustomEvent("Active Alert").putCustomAttribute("Alert", alert.getClass().getSimpleName()));
} else if (alertActivity != null) {
alertActivity.setAlertMessage(activeAlertMessage);
alertActivity.update();
}
}
}
Aggregations