mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-01 14:45:08 +00:00
Fixed bugs in NotificationsPlugin
Already existing notifications were not retrieved Notifications without tickerText were crashing the plugin
This commit is contained in:
@@ -126,12 +126,10 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
|||||||
public void onServiceStart(NotificationReceiver service) {
|
public void onServiceStart(NotificationReceiver service) {
|
||||||
try {
|
try {
|
||||||
service.addListener(NotificationsPlugin.this);
|
service.addListener(NotificationsPlugin.this);
|
||||||
/*
|
|
||||||
StatusBarNotification[] notifications = service.getActiveNotifications();
|
StatusBarNotification[] notifications = service.getActiveNotifications();
|
||||||
for (StatusBarNotification notification : notifications) {
|
for (StatusBarNotification notification : notifications) {
|
||||||
onNotificationPosted(notification);
|
onNotificationPosted(notification);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.e("NotificationsPlugin","Exception");
|
Log.e("NotificationsPlugin","Exception");
|
||||||
@@ -204,7 +202,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
|||||||
np.set("id", id.serialize());
|
np.set("id", id.serialize());
|
||||||
np.set("appName", appName == null? packageName : appName);
|
np.set("appName", appName == null? packageName : appName);
|
||||||
np.set("isClearable", statusBarNotification.isClearable());
|
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()));
|
np.set("time", Long.toString(statusBarNotification.getPostTime()));
|
||||||
if (requestAnswer) np.set("requestAnswer", true);
|
if (requestAnswer) np.set("requestAnswer", true);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user