Search in sources :

Example 91 with Notification

use of android.app.Notification in project k-9 by k9mail.

the class NewMailNotifications method createStackedNotification.

private void createStackedNotification(Account account, NotificationHolder holder) {
    if (isPrivacyModeEnabled()) {
        return;
    }
    Notification notification = wearNotifications.buildStackedNotification(account, holder);
    int notificationId = holder.notificationId;
    getNotificationManager().notify(notificationId, notification);
}
Also used : Notification(android.app.Notification)

Example 92 with Notification

use of android.app.Notification in project android-oss by kickstarter.

the class PushNotifications method displayNotificationFromProjectActivity.

private void displayNotificationFromProjectActivity(@NonNull final PushNotificationEnvelope envelope) {
    final GCM gcm = envelope.gcm();
    final Activity activity = envelope.activity();
    if (activity == null) {
        return;
    }
    final Long projectId = activity.projectId();
    if (projectId == null) {
        return;
    }
    final String projectPhoto = activity.projectPhoto();
    final String projectParam = ObjectUtils.toString(projectId);
    NotificationCompat.Builder notificationBuilder = notificationBuilder(gcm.title(), gcm.alert()).setContentIntent(projectContentIntent(envelope, projectParam));
    if (projectPhoto != null) {
        notificationBuilder = notificationBuilder.setLargeIcon(fetchBitmap(projectPhoto, false));
    }
    final Notification notification = notificationBuilder.build();
    notificationManager().notify(envelope.signature(), notification);
}
Also used : GCM(com.kickstarter.models.pushdata.GCM) ProjectActivity(com.kickstarter.ui.activities.ProjectActivity) Activity(com.kickstarter.models.pushdata.Activity) WebViewActivity(com.kickstarter.ui.activities.WebViewActivity) NotificationCompat(android.support.v4.app.NotificationCompat) Notification(android.app.Notification)

Example 93 with Notification

use of android.app.Notification in project android-oss by kickstarter.

the class PushNotifications method displayNotificationFromProjectReminder.

private void displayNotificationFromProjectReminder(@NonNull final PushNotificationEnvelope envelope) {
    final GCM gcm = envelope.gcm();
    final PushNotificationEnvelope.Project project = envelope.project();
    if (project == null) {
        return;
    }
    final Notification notification = notificationBuilder(gcm.title(), gcm.alert()).setContentIntent(projectContentIntent(envelope, ObjectUtils.toString(project.id()))).setLargeIcon(fetchBitmap(project.photo(), false)).build();
    notificationManager().notify(envelope.signature(), notification);
}
Also used : GCM(com.kickstarter.models.pushdata.GCM) PushNotificationEnvelope(com.kickstarter.services.apiresponses.PushNotificationEnvelope) Notification(android.app.Notification)

Example 94 with Notification

use of android.app.Notification in project Signal-Android by WhisperSystems.

the class UpdateApkReadyListener method displayInstallNotification.

private void displayInstallNotification(Context context, Uri uri) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(uri, "application/vnd.android.package-archive");
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
    Notification notification = new NotificationCompat.Builder(context).setOngoing(true).setContentTitle(context.getString(R.string.UpdateApkReadyListener_Signal_update)).setContentText(context.getString(R.string.UpdateApkReadyListener_a_new_version_of_signal_is_available_tap_to_update)).setSmallIcon(R.drawable.icon_notification).setColor(context.getResources().getColor(R.color.textsecure_primary)).setPriority(NotificationCompat.PRIORITY_HIGH).setCategory(NotificationCompat.CATEGORY_REMINDER).setContentIntent(pendingIntent).build();
    ServiceUtil.getNotificationManager(context).notify(666, notification);
}
Also used : NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent) Notification(android.app.Notification)

Example 95 with Notification

use of android.app.Notification in project Signal-Android by WhisperSystems.

the class RegistrationNotifier method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
    builder.setSmallIcon(R.drawable.icon_notification);
    builder.setContentTitle(intent.getStringExtra(RegistrationService.NOTIFICATION_TITLE));
    builder.setContentText(intent.getStringExtra(RegistrationService.NOTIFICATION_TEXT));
    builder.setContentIntent(PendingIntent.getActivity(context, 0, new Intent(context, ConversationListActivity.class), 0));
    builder.setWhen(System.currentTimeMillis());
    builder.setDefaults(Notification.DEFAULT_VIBRATE);
    builder.setAutoCancel(true);
    Notification notification = builder.build();
    ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)).notify(31337, notification);
}
Also used : NotificationManager(android.app.NotificationManager) NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) Notification(android.app.Notification)

Aggregations

Notification (android.app.Notification)568 PendingIntent (android.app.PendingIntent)276 Intent (android.content.Intent)253 NotificationManager (android.app.NotificationManager)128 StatusBarNotification (android.service.notification.StatusBarNotification)96 NotificationCompat (android.support.v4.app.NotificationCompat)64 Resources (android.content.res.Resources)56 Bitmap (android.graphics.Bitmap)48 Test (org.junit.Test)48 Context (android.content.Context)47 ITransientNotification (android.app.ITransientNotification)32 RemoteViews (android.widget.RemoteViews)30 RemoteException (android.os.RemoteException)24 ApplicationInfo (android.content.pm.ApplicationInfo)17 UserHandle (android.os.UserHandle)17 Date (java.util.Date)16 Uri (android.net.Uri)15 Bundle (android.os.Bundle)15 ComponentName (android.content.ComponentName)13 File (java.io.File)13