Update NotificationListener.java

dev
wangsiyuan 2024-04-22 15:12:55 +08:00
parent 21dc14ba5f
commit c416971d67
1 changed files with 2 additions and 1 deletions

View File

@ -46,7 +46,8 @@ public class NotificationListener extends NotificationListenerService {
}
Bundle extras = sbn.getNotification().extras;
String title = extras.getString(Notification.EXTRA_TITLE);
CharSequence titleCharSequence = extras.getCharSequence(Notification.EXTRA_TITLE);
String title = titleCharSequence != null ? titleCharSequence.toString() : null;
String content = extras.getString(Notification.EXTRA_TEXT);
String tickerText = sbn.getNotification().tickerText != null ? sbn.getNotification().tickerText.toString() : "";
String logMessage = String.format("packageName: %s,title: %s,content: %s,tickerText: %s", packageName, title, content, tickerText);