@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); }
@Override public void onNotificationPosted(StatusBarNotification sbn) { RemoteViews views = sbn.getNotification().contentView; RemoteViewsInfo info = RemoteViewsReader.read(this, views); if (info == null) return; List<RemoteViewsAction> actions = info.getActions(); for (RemoteViewsAction action : actions) Log.v("NotificationWatcher", action.getActionName()); }
@SuppressLint("NewApi") @Override public void onNotificationPosted(StatusBarNotification sbn) { String pack = sbn.getPackageName(); // String ticker = sbn.getNotification().tickerText.toString(); Bundle extras = sbn.getNotification().extras; String title = extras.getString("android.title"); String text = extras.getCharSequence("android.text").toString(); Log.i("Package", pack); // Log.i("Ticker", ticker); Log.i("Title", title); Log.i("Text", text); Intent msgrcv = new Intent("Msg"); msgrcv.putExtra("package", pack); // msgrcv.putExtra("ticker", ticker); msgrcv.putExtra("title", title); msgrcv.putExtra("text", text); LocalBroadcastManager.getInstance(context).sendBroadcast(msgrcv); }