forked from jens/Automation
notification action
This commit is contained in:
parent
22899347a1
commit
a0c4cb7b6f
@ -104,8 +104,8 @@ public class NotificationListener extends NotificationListenerService// implemen
|
||||
public static SimpleNotification convertNotificationToSimpleNotification(boolean created, StatusBarNotification input)
|
||||
{
|
||||
String app = input.getPackageName();
|
||||
String title = null;
|
||||
String text = null;
|
||||
String title = "";
|
||||
String text = "";
|
||||
|
||||
Bundle extras = input.getNotification().extras;
|
||||
|
||||
@ -117,6 +117,8 @@ public class NotificationListener extends NotificationListenerService// implemen
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
// https://www.b4x.com/android/forum/threads/solved-reading-statusbarnotifications-extras.64416/
|
||||
// Some notifications have an empty title, like KDE connect
|
||||
if(extras.containsKey(EXTRA_TITLE) && extras.get(EXTRA_TITLE) != null)
|
||||
title = extras.get(EXTRA_TITLE).toString();
|
||||
}
|
||||
|
||||
@ -127,7 +129,8 @@ public class NotificationListener extends NotificationListenerService// implemen
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
// https://www.b4x.com/android/forum/threads/solved-reading-statusbarnotifications-extras.64416/
|
||||
// in stacked notifications the "surrounding" element has no text, only a title
|
||||
if (extras.containsKey(EXTRA_TEXT) && extras.get(EXTRA_TEXT) != null)
|
||||
text = extras.get(EXTRA_TEXT).toString();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user