From f652b1b3c683574eb593d0b00acbc43d936c1ca1 Mon Sep 17 00:00:00 2001 From: Greg Alexander Date: Mon, 17 Oct 2016 09:12:11 -0400 Subject: [PATCH] add a contentView to the notification, which is needed at least in android 5 (and probably earlier) --- res/layout/notification.xml | 12 ++++++++++++ src/org/galexander/sshd/SimpleSSHDService.java | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 res/layout/notification.xml diff --git a/res/layout/notification.xml b/res/layout/notification.xml new file mode 100644 index 0000000..4ec387c --- /dev/null +++ b/res/layout/notification.xml @@ -0,0 +1,12 @@ + + + + diff --git a/src/org/galexander/sshd/SimpleSSHDService.java b/src/org/galexander/sshd/SimpleSSHDService.java index e5e5328..5666194 100644 --- a/src/org/galexander/sshd/SimpleSSHDService.java +++ b/src/org/galexander/sshd/SimpleSSHDService.java @@ -6,6 +6,7 @@ import android.app.Service; import android.content.Intent; import android.content.Context; import android.os.IBinder; +import android.widget.RemoteViews; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -66,6 +67,10 @@ public class SimpleSSHDService extends Service { n.contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, SimpleSSHD.class), PendingIntent.FLAG_UPDATE_CURRENT); + + n.contentView = new RemoteViews(getPackageName(), + R.layout.notification); + startForeground(1, n); } }