2012-07-19 49 views
0

我正在提供包含通知的輔助功能服務,我想知道是否可以獲取圖標位圖和通知的「詳細信息」,我知道tickertext可以提供「通知標題」但我想訪問顯示通知的contentview字段的「詳細信息文本」以前的「getText」方法的行。獲取通知字段

+0

真的沒有人對此感興趣嗎? :O – 2012-07-20 05:16:52

+0

您是否自己創建通知?我想不是。 – RaphMclee 2012-07-26 11:00:23

+0

Noup,第三方通知 – 2012-07-26 18:52:19

回答

0

有可能獲得更多細節,甚至重建Notification對象。我沒有測試過,但它應該可以正常工作。

@Override 
public void onAccessibilityEvent(AccessibilityEvent event) { 
... 
    if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) { 
     Parcelable parcelable = event.getParcelableData(); 
     if (parcelable instanceof Notification) { 
      // Resource id within the package context of the notifying app. 
      int icon = ((Notification) parcelable).icon; 
      Resources res = getPackageManager().getResourcesForApplication(event.getPackageName()); 
      Drawable image = res.getDrawable(icon); 
     } 
    } 
}