@Override public void onNotificationPosted(StatusBarNotification sbn) { Log.i(TAG, sbn.getPackageName() + " Notification received:" + sbn.getNotification().tickerText); Notification postedNotification = sbn.getNotification(); String packageName = sbn.getPackageName(); if (postedNotification.tickerText == null || sbn.isOngoing() || !sbn.isClearable() || isInBlackList(packageName)) { return; } mNotificationHub.addNotification(sbn); mNotificationHub.setCurrentNotification(sbn); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); // Retrieve user specified peek timeout. int peekTimeoutMultiplier = Integer.parseInt(preferences.getString(PreferenceKeys.PREF_PEEK_TIMEOUT, "1")); // Does user select always listening? boolean alwaysListening = preferences.getBoolean(PreferenceKeys.PREF_ALWAYS_LISTENING, false); mNotificationPeek.showNotification(sbn, false, peekTimeoutMultiplier, alwaysListening); }