diff options
| author | Daniel Sandler <dsandler@android.com> | 2013-04-24 15:34:57 -0400 |
|---|---|---|
| committer | Daniel Sandler <dsandler@android.com> | 2013-04-24 23:19:08 -0400 |
| commit | 25cf8cee6f304a286d321204e448b18ce733a60c (patch) | |
| tree | 07f36464efefd2890fd42ee7b7a8fb2303abb009 /core/java/android/service | |
| parent | 7395838d8e45cf39c34d2f2e18da2bedd3e4dc33 (diff) | |
| download | frameworks_base-25cf8cee6f304a286d321204e448b18ce733a60c.zip frameworks_base-25cf8cee6f304a286d321204e448b18ce733a60c.tar.gz frameworks_base-25cf8cee6f304a286d321204e448b18ce733a60c.tar.bz2 | |
New NotificationListener API: getActiveNotifications()
This allows a listener service to catch up on the current
state of the notification panel at any time, including at
startup.
Bug: 8656860
Change-Id: I1a3d665d84576e17870929a63dda334afc696010
Diffstat (limited to 'core/java/android/service')
| -rw-r--r-- | core/java/android/service/notification/NotificationListenerService.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 8b72ca9..6a5864c 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -124,6 +124,21 @@ public abstract class NotificationListenerService extends Service { } } + /** + * Request the list of outstanding notifications (that is, those that are visible to the + * current user). Useful when starting up and you don't know what's already been posted. + * + * @return An array of active notifications. + */ + public StatusBarNotification[] getActiveNotifications() { + try { + return getNotificationInterface().getActiveNotificationsFromListener(mWrapper); + } catch (android.os.RemoteException ex) { + Log.v(TAG, "Unable to contact notification manager", ex); + } + return null; + } + @Override public IBinder onBind(Intent intent) { if (mWrapper == null) { |
