从通知 Android 抓取大文本 [英] Grab big text from Notification Android
本文介绍了从通知 Android 抓取大文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 NotificationListenerService
来监听通知.
I'm using NotificationListenerService
to listen for notifications.
当我收到通知时,我使用以下代码提取标题和消息:
When I receive a notification, I extract the title and message using the following code:
Bundle n = sbn.getNotification().extras;
String title = n.getString(Notification.EXTRAS_TITLE);
String message = n.getString(Notification.EXTRAS_TEXT);
问题是当我收到 BigTextStyle 的通知时.
The problem is when I receive a notification with BigTextStyle.
如何检索其值?
谢谢.
推荐答案
从我在文档中看到的,你可以这样做:
From what I see in the documentation, you can do:
Bundle n = sbn.getNotification().extras;
String title = n.getString(Notification.EXTRAS_TITLE);
String message = n.getString(Notification.EXTRAS_TEXT);
String bigText = n.getString(Notification.EXTRA_BIG_TEXT);
参考:https://developer.android.com/reference/android/app/Notification.html#EXTRA_BIG_TEXT
这篇关于从通知 Android 抓取大文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文