I'm trying to get notification content using:
val sender = sbn.notification.extras.getString("android.title")
val msg = sbn.notification.extras.getString("android.text")
android.title
returns the desired value, but android.text
returns null
.
Upon debugging, I found out:
W/Bundle: Key android.text expected String but value was a android.text.SpannableString. The default value <null> was returned.
W/Bundle: Attempt to cast generated internal exception:
java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String
Why android.text
is returning SpannableString
? And how can I convert it to String
in this case?