use of de.danoeh.antennapod.core.gpoddernet.GpodnetServiceAuthenticationException in project AntennaPod by AntennaPod.
the class GpodnetSyncService method updateErrorNotification.
private void updateErrorNotification(GpodnetServiceException exception) {
Log.d(TAG, "Posting error notification");
GpodnetPreferences.setLastSyncAttempt(false, System.currentTimeMillis());
final String title;
final String description;
final int id;
if (exception instanceof GpodnetServiceAuthenticationException) {
title = getString(R.string.gpodnetsync_auth_error_title);
description = getString(R.string.gpodnetsync_auth_error_descr);
id = R.id.notification_gpodnet_sync_autherror;
} else {
if (UserPreferences.gpodnetNotificationsEnabled()) {
title = getString(R.string.gpodnetsync_error_title);
description = getString(R.string.gpodnetsync_error_descr) + exception.getMessage();
id = R.id.notification_gpodnet_sync_error;
} else {
return;
}
}
PendingIntent activityIntent = ClientConfig.gpodnetCallbacks.getGpodnetSyncServiceErrorNotificationPendingIntent(this);
Notification notification = new NotificationCompat.Builder(this).setContentTitle(title).setContentText(description).setContentIntent(activityIntent).setSmallIcon(R.drawable.stat_notify_sync_error).setAutoCancel(true).setVisibility(NotificationCompat.VISIBILITY_PUBLIC).build();
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(id, notification);
}
Aggregations