2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 13:47:41 +00:00

Fixed bugs in NotificationsPlugin

Already existing notifications were not retrieved
Notifications without tickerText were crashing the plugin
This commit is contained in:
Albert Vaca 2013-11-06 21:15:49 +01:00
parent 996516ec88
commit 786ea7658f

View File

@ -126,12 +126,10 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
public void onServiceStart(NotificationReceiver service) {
try {
service.addListener(NotificationsPlugin.this);
/*
StatusBarNotification[] notifications = service.getActiveNotifications();
for (StatusBarNotification notification : notifications) {
onNotificationPosted(notification);
}
*/
} catch(Exception e) {
e.printStackTrace();
Log.e("NotificationsPlugin","Exception");
@ -204,7 +202,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
np.set("id", id.serialize());
np.set("appName", appName == null? packageName : appName);
np.set("isClearable", statusBarNotification.isClearable());
np.set("ticker", notification.tickerText.toString());
np.set("ticker", (notification != null && notification.tickerText != null)? notification.tickerText.toString() : "");
np.set("time", Long.toString(statusBarNotification.getPostTime()));
if (requestAnswer) np.set("requestAnswer", true);