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

android 5 (and probably earlier)
sigsegv_dump
Greg Alexander 8 years ago
parent fadb6909cf
commit f652b1b3c6

@ -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>

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

Loading…
Cancel
Save