I'm using the notification listener api to read notification information but it seems impossible to read the text of a Gmail notification. Here what adb says:
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]
}
android.largeIcon=android.graphics.Bitmap@b15c6130 (128x128)
android.infoText=null
android.wearable.EXTENSIONS=Bundle[mParcelledData.dataSize=1200]
android.progressIndeterminate=false
android.scoreModified=false
}
With other notification it works. Any tips? I'm reading the notification in this way:
String text = extras.getString(Notification.EXTRA_TEXT);
Ok problem solved. The information about the notification are stored as CharSequence so you have to get it with getCharSequence()
. Since String implements the CharSequence interface it's possible that it works but not always. However using CharSequence it works.