Example usage for android.app NotificationManager cancel

List of usage examples for android.app NotificationManager cancel

Introduction

In this page you can find the example usage for android.app NotificationManager cancel.

Prototype

public void cancel(int id) 

Source Link

Document

Cancel a previously shown notification.

Usage

From source file:ca.rmen.android.networkmonitor.app.service.NetMonNotification.java

public static void dismissEmailFailureNotification(Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(NOTIFICATION_ID_FAILED_EMAIL);
}

From source file:ca.rmen.android.networkmonitor.app.service.NetMonNotification.java

public static void dismissFailedTestNotification(Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(NOTIFICATION_ID_FAILED_TEST);
}

From source file:ca.rmen.android.networkmonitor.app.service.NetMonNotification.java

static void dismissNotifications(Context context) {
    Log.v(TAG, "dismissNotification");
    context.unregisterReceiver(sDisableBroadcastReceiver);
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(NOTIFICATION_ID_ONGOING);
    notificationManager.cancel(NOTIFICATION_ID_FAILED_EMAIL);
    notificationManager.cancel(NOTIFICATION_ID_FAILED_TEST);
}

From source file:com.android.settings.sim.SimBootReceiver.java

public static void cancelNotification(Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(NOTIFICATION_ID);
}

From source file:com.google.android.gcm.demo.app.GCMIntentService.java

/**
 * Issues a notification to inform the user that server has sent a message.
 *//*w ww.j  a  v  a2 s .co m*/
private static void generateNotification(Context context, String message, String data) {
    int icon = R.drawable.ic_stat_gcm;
    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(0);

    Notification notification = new Notification(icon, message, when);
    String title = context.getString(R.string.app_name);
    Intent notificationIntent = new Intent(context, DemoActivity.class);
    notificationIntent.putExtra(CommonUtilities.EXTRA_TEAM_IN_JSON, data);
    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    notification.setLatestEventInfo(context, title, message, intent);
    notification.flags = Notification.FLAG_AUTO_CANCEL;
    notificationManager.notify(0, notification);
}

From source file:nl.sogeti.android.gpstracker.streaming.CustomUpload.java

private static void clearNotification(Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(NOTIFICATION_ID);
}

From source file:de.azapps.mirakel.services.NotificationService.java

public static void stop(final Context ctx) {
    final NotificationManager notificationManager = (NotificationManager) ctx
            .getSystemService(NOTIFICATION_SERVICE);
    notificationManager.cancel(DefinitionsHelper.NOTIF_DEFAULT);
}

From source file:com.tourmaline.example.helpers.Alerts.java

public static void hide(final Context context, final Type type) {
    final NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    switch (type) {
    case GPS://ww  w.jav  a  2  s  .  c  o  m
        notificationManager.cancel(NOTIF_ID_GPS);
        break;
    case PERMISSION:
        notificationManager.cancel(NOTIF_ID_PERMISSION);
        break;
    case POWER:
        notificationManager.cancel(NOTIF_ID_POWER);
        break;
    }
}

From source file:com.veniosg.dir.android.util.Notifier.java

public static void clearNotification(int notId, Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(notId);
}

From source file:com.deepak.myclock.alarms.AlarmNotifications.java

public static void clearNotification(Context context, AlarmInstance instance) {
    Log.v("Clearing notifications for alarm instance: " + instance.mId);
    NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    nm.cancel(instance.hashCode());
}