我已经实现了一个通知监听器来寻找 Gmail 通知。
我想从通知中收集扩展文本(大文本),如下面的通知所示:
请参阅“----转发的消息---”等,它仅在用户展开通知以显示操作按钮时出现。
此字符串值未出现在通知的“EXTRAS”数据中...
http://developer.android.com/reference/android/app/Notification.html
最佳答案
查看以上链接后,我进一步调查了 bundle (EXTRAS) 数据。当你调试它并查看变量时,你会发现所有关于通知的信息都存储在包中,你可以通过
获取详细信息notifyBundle.extras.getCharSequence("android.textLines")
用于多行通知和
notifyBundle.extras.getString("android.text")
用于单行通知。
更多信息,看eclipse Debug模式下的变量
Image of variables in bundle for single line notification
Image of variables in bundle for multi line notification
注意:额外的 bundle 仅在 API19 (Kitkat) 中可用。我从未在低于 API19 的设备上尝试过。
关于android - 从 Android 通知中获取详细信息/扩展文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22330809/