2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 05:37:43 +00:00

Fixed not being able to read some customized notifications

Fixed error "Expected String but value was a android.text.SpannableString"
This commit is contained in:
Albert Vaca 2015-01-10 00:40:36 -08:00
parent c4a87ecb50
commit 74bec9a7de

View File

@ -292,9 +292,11 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
try { try {
Bundle extras = notification.extras; Bundle extras = notification.extras;
String extraTitle = extras.getString(TITLE_KEY); 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; ticker = extraTitle + " " + extraText;
} else if (extraTitle != null) { } else if (extraTitle != null) {
ticker = extraTitle; ticker = extraTitle;
@ -302,7 +304,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
ticker = extraText; ticker = extraText;
} }
} catch(Exception e) { } catch(Exception e) {
Log.w("NotificationPlugin","problem parsing notification extras"); Log.w("NotificationPlugin","problem parsing notification extras for " + notification.tickerText);
e.printStackTrace(); e.printStackTrace();
} }
} }