[英]Impossible to read gmail notification
I'm using the notification listener api to read notification information but it seems impossible to read the text of a Gmail notification. 我正在使用通知侦听器api来读取通知信息,但似乎无法读取Gmail通知的文本。 Here what adb says: 这是亚行说的:
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
}
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()
. 关于通知的信息存储为CharSequence,因此您必须使用getCharSequence()
来获取它。 Since String implements the CharSequence interface it's possible that it works but not always. 由于String实现了CharSequence接口,因此可能会起作用,但并非总是如此。 However using CharSequence it works. 但是使用CharSequence可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.