Exemplo n.º 1
0
 private NotificationCompat.Builder createNotificationBuilder() {
   PendingIntent pi =
       PendingIntent.getBroadcast(mContext, 0, new Intent(SyncService.ACTION_CANCEL_SYNC), 0);
   return NotificationUtils.createNotificationBuilder(mContext, R.string.sync_notification_title)
       .setPriority(NotificationCompat.PRIORITY_LOW)
       .setOngoing(true)
       .addAction(R.drawable.ic_stat_cancel, mContext.getString(R.string.cancel), pi);
 }
Exemplo n.º 2
0
  private void showError(String text, String message) {
    if (!mShowNotifications) return;

    NotificationCompat.Builder builder =
        NotificationUtils.createNotificationBuilder(mContext, R.string.sync_notification_title)
            .setContentText(text);
    if (!TextUtils.isEmpty(message)) {
      builder.setStyle(new NotificationCompat.BigTextStyle().bigText(message).setSummaryText(text));
    }
    NotificationUtils.notify(mContext, NotificationUtils.ID_SYNC_ERROR, builder);
  }