2014-11-14 56 views
1

我使用通知偵聽器API來讀取通知信息,但似乎無法讀取Gmail通知的文本。這裏adb說:無法讀取Gmail通知

extras={ 
     android.title=john 
     android.support.actionExtras={0=Bundle[EMPTY_PARCEL], 1=Bundle[EMPTY_PARCEL]} 
     [email protected] 
     android.showChronometer=false 
     android.icon=2130837727 
     android.text=MyText 
     android.progress=0 
     android.progressMax=0 
     android.showWhen=true 
     android.people=[Ljava.lang.String;@b1564718 { 
      mailto:[email protected] 
     } 
     [email protected] (128x128) 
     android.infoText=null 
     android.wearable.EXTENSIONS=Bundle[mParcelledData.dataSize=1200] 
     android.progressIndeterminate=false 
     android.scoreModified=false 
     } 

與其他通知它的工作。有小費嗎?我以這種方式閱讀通知:

String text = extras.getString(Notification.EXTRA_TEXT); 

回答

1

好的問題解決了。有關通知的信息存儲爲CharSequence所以你必須得到getCharSequence()。由於String實現了CharSequence接口,它可能會工作,但並非總是如此。然而,使用CharSequence它的作品。