From 74bec9a7def794b7d957d114f7248c2b726fde04 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sat, 10 Jan 2015 00:40:36 -0800 Subject: [PATCH] Fixed not being able to read some customized notifications Fixed error "Expected String but value was a android.text.SpannableString" --- .../Plugins/NotificationsPlugin/NotificationsPlugin.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java index e4f08e58..add8ecf7 100644 --- a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java @@ -292,9 +292,11 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver. try { Bundle extras = notification.extras; String extraTitle = extras.getString(TITLE_KEY); - String extraText = extras.getString(TEXT_KEY); + String extraText = null; + Object extraTextExtra = extras.get(TEXT_KEY); + if (extraTextExtra != null) extraText = extraTextExtra.toString(); - if (extraTitle != null && extraText != null) { + if (extraTitle != null && extraText != null && !extraText.isEmpty()) { ticker = extraTitle + " ‐ " + extraText; } else if (extraTitle != null) { ticker = extraTitle; @@ -302,7 +304,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver. ticker = extraText; } } catch(Exception e) { - Log.w("NotificationPlugin","problem parsing notification extras"); + Log.w("NotificationPlugin","problem parsing notification extras for " + notification.tickerText); e.printStackTrace(); } }