Code example for NotificationManager

Methods: cancelAll

0
    public void onDestroy() { 
        Log.v(TAG, "onDestroy");
 
        // remove the notification 
        NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        nm.cancelAll();
        stopForeground(true);
 
        // we where asked to stop running, so make sure the user gets back his 
        // status bar 
        Device device = Device.getInstance();
        device.showSystembar(true);
    } 
 
    @Override 
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.v(TAG, "onStartCommand");
 
        // we just have to start service once, not keep restarting 
        return Service.START_NOT_STICKY;
    }