1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-30 00:01:19 +00:00

Added persistent notification while service is running.

This commit is contained in:
Felix Ableitner 2014-05-06 12:58:58 +02:00
parent 5f0b54f069
commit 472ccb6bed

View file

@ -1,5 +1,6 @@
package com.nutomic.syncthingandroid; package com.nutomic.syncthingandroid;
import android.app.Notification;
import android.app.Service; import android.app.Service;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
@ -9,8 +10,16 @@ public class SyncthingService extends Service {
private static final String TAG = "SyncthingService"; private static final String TAG = "SyncthingService";
private static final int NOTIFICATION_ID = 1;
@Override @Override
public void onCreate() { public void onCreate() {
Notification n = new Notification.Builder(this)
.setContentTitle(getString(R.string.app_name))
.setSmallIcon(R.drawable.ic_launcher)
.build();
startForeground(NOTIFICATION_ID, n);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {