Example usage for android.content Context NOTIFICATION_SERVICE

List of usage examples for android.content Context NOTIFICATION_SERVICE

Introduction

In this page you can find the example usage for android.content Context NOTIFICATION_SERVICE.

Prototype

String NOTIFICATION_SERVICE

To view the source code for android.content Context NOTIFICATION_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.app.NotificationManager for informing the user of background events.

Usage

From source file:Main.java

public static void cancel(Context context, String tag, int id) {
    NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    nm.cancel(tag, id);//www .  jav  a 2 s  . c om
}

From source file:Main.java

public static NotificationManager getNotificationManager(Context context) {
    if (manager == null) {
        manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    }/*from   w ww . j a  v a2 s  . c om*/
    return manager;
}

From source file:Main.java

public static final void init(Context mContext) {
    notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
}

From source file:Main.java

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

From source file:Main.java

/** Cancel the ongoing notification that controls the connection state and play/stop*/
public static void cancelNotification(Context context, int id) {
    NotificationManager mNotifyMgr = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    mNotifyMgr.cancel(id);/* w w w .  j av a  2s.c  o  m*/
}

From source file:Main.java

private static void notifyUpdate(Context ctx) {
    if (mNotification == null)
        return;/*from  w  ww  .  j  a  v a2s.c om*/
    NotificationManager nm = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
    nm.notify(1, mNotification);
}

From source file:Main.java

public static NotificationManager getNotificationManager(Context context) {
    if (notificationManager == null) {
        notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    }/*from  w  ww . jav  a2 s .  com*/
    return notificationManager;
}

From source file:Main.java

public static void cancelAllNotifications(@NonNull Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancelAll();//from  w  w  w.ja  v  a 2 s.  c o  m
}

From source file:Main.java

public static void sendNotification(Context context, int id, Notification notification) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(id, notification);
}

From source file:Main.java

public static void clearNotifications(Context context) {
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(NOTIFICATION_ID_ALL_PLAYERS_PERSISTENT);
    notificationManager.cancel(NOTIFICATION_ID_INDIVIDUAL_PLAYERS);
}