我正在使用通知监听器 api 来读取通知信息,但似乎无法读取 Gmail 通知的文本。这是亚行所说的:
extras={
android.title=john
android.support.actionExtras={0=Bundle[EMPTY_PARCEL], 1=Bundle[EMPTY_PARCEL]}
android.subText=bar@gmail.com
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:foo@gmail.com
}
android.largeIcon=android.graphics.Bitmap@b15c6130 (128x128)
android.infoText=null
android.wearable.EXTENSIONS=Bundle[mParcelledData.dataSize=1200]
android.progressIndeterminate=false
android.scoreModified=false
}
与其他通知一起使用。有小费吗?我正在以这种方式阅读通知:
String text = extras.getString(Notification.EXTRA_TEXT);
最佳答案
好的,问题解决了。有关通知的信息存储为 CharSequence,因此您必须使用 getCharSequence()
获取它。由于 String 实现了 CharSequence 接口(interface),因此它可能有效但并非总是如此。然而,使用 CharSequence 它是有效的。
关于android - 无法阅读 gmail 通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26936628/