mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-26 14:21:16 +00:00
Added persistent notification while service is running.
This commit is contained in:
parent
5f0b54f069
commit
472ccb6bed
1 changed files with 9 additions and 0 deletions
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue