Get text from expanded notification in status bar?

允我心安 提交于 2019-12-05 13:53:21

Okay so with this new information I would try something like this:

SpannableString bigText = (SpannableString) mExtras.get(Notification.EXTRA_TEXT);
if(bigText != null){
    body = bigText.toString();
}

Edit: After reviewing the source I would try this:

CharSequence bigText = (CharSequence) mExtras.getCharSequence(Notification.EXTRA_TEXT);
if(bigText != null){
    body = bigText.toString();
}

When any notification generates Big Style Notification, expanded text can be fetched with android.bigText key :

if(mExtras.getCharSequence("android.bigText")) {
    String body = mExtras.getCharSequence("android.bigText");
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!