1
0
mirror of http://galexander.org/git/simplesshd.git synced 2024-11-14 02:59:05 +00:00

add a contentView to the notification, which is needed at least in

android 5 (and probably earlier)
This commit is contained in:
Greg Alexander 2016-10-17 09:12:11 -04:00
parent fadb6909cf
commit f652b1b3c6
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/notification_text"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="SimpleSSHD is running" />
</LinearLayout>

View File

@ -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);
}
}