Example usage for android.app NotificationManager cancelAll

List of usage examples for android.app NotificationManager cancelAll

Introduction

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

Prototype

public void cancelAll() 

Source Link

Document

Cancel all previously shown notifications.

Usage

From source file:com.nuvolect.securesuite.util.NotificationUtil.java

public static void cancelAll(Context context) {
    NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    nm.cancelAll();
}

From source file:com.jameswolfeoliver.pigeon.Managers.NotificationsManager.java

public static void removeAllNotifications(Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancelAll();
}

From source file:grk.impala.GCMIntentService.java

private static void generateNotification(Context context, String message) {
    Intent notificationIntent = null;// w  w  w. jav a2 s .  c  o  m
    if (PrefUtil.getLoggedIn(context)) {
        if (PrefUtil.getUserType(context) == 2) {
            notificationIntent = new Intent(context, StatusActivity.class);
        } else {
            notificationIntent = new Intent(context, NotificationActivity.class);
        }
    } else {
        notificationIntent = new Intent(context, SplashActivity.class);
    }

    PendingIntent contentIntent = TaskStackBuilder.create(context)
            .addNextIntentWithParentStack(notificationIntent)
            .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
            .setSmallIcon(R.mipmap.ic_launcher).setContentTitle(context.getString(R.string.app_name))
            .setStyle(new NotificationCompat.BigTextStyle().bigText(message)).setContentText(message)
            .setAutoCancel(true).setDefaults(
                    Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS);

    mBuilder.setContentIntent(contentIntent);
    NotificationManager mNotificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.cancelAll();
    mNotificationManager.notify(0, mBuilder.build());
}

From source file:com.google.android.apps.santatracker.notification.SantaNotificationBuilder.java

/**
 * Dismiss all notifications.//from   w  w w  .  j  ava2s . c om
 */
public static void DismissNotifications(Context c) {
    NotificationManager mNotificationManager = (NotificationManager) c
            .getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.cancelAll();
}

From source file:com.google.android.apps.santatracker.SantaNotificationBuilder.java

/**
 * Dismiss all notifications.//  w w w  .  j  ava 2  s  .c o  m
 */
public static void DismissNotifications(Context c) {
    NotificationManager mNotificationManager = (NotificationManager) c
            .getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.cancelAll();

    // Send a broadcast to the phone's service, so it will update the data API to
    // let the watch know to cancel all its corresponding notifications.
    Intent dismissWearableNotifications = new Intent(c, PhoneNotificationService.class);
    dismissWearableNotifications.setAction(NotificationConstants.ACTION_DISMISS);
    c.sendBroadcast(dismissWearableNotifications);

}

From source file:com.example.mego.adas.utils.NotificationUtils.java

/**
 * Helper Method to clear all the app notification
 *///from ww  w.j a v  a  2s .com
public static void clearAllNotifications(Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancelAll();
}

From source file:com.odoo.core.utils.notification.ONotificationBuilder.java

public static void cancelNotification(Context context) {
    NotificationManager nMgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    nMgr.cancelAll();
    ;//from   www . j  ava  2  s  . co  m
}

From source file:com.bhb27.isu.tools.Tools.java

public static void ClearAllNotification(Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancelAll();
}

From source file:org.addhen.smssync.util.Util.java

/**
 * Clear all notifications shown to the user.
 * //from w w w. j av a2s . co  m
 * @param Context
 *            context - The context of the calling activity.
 * @return void.
 */
public static void clearAll(Context context) {
    NotificationManager myNM = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    myNM.cancelAll();
}

From source file:com.frostwire.android.gui.services.EngineService.java

private static void cancelAllNotificationsTask(EngineService engineService) {
    try {/*from  ww  w  .j a v  a  2s.c o m*/
        NotificationManager notificationManager = (NotificationManager) engineService
                .getSystemService(NOTIFICATION_SERVICE);
        if (notificationManager != null) {
            notificationManager.cancelAll();
        }
    } catch (SecurityException ignore) {
        // new exception in Android 7
    }
}