diff --git a/briar-android/AndroidManifest.xml b/briar-android/AndroidManifest.xml
index a81aeebad..55dd04a54 100644
--- a/briar-android/AndroidManifest.xml
+++ b/briar-android/AndroidManifest.xml
@@ -17,10 +17,10 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
-
+
Briar
+ FIXME: Notification title
+ FIXME: Notification text
Welcome to Briar! Add a contact to get started.
For security reasons you must be face to face with someone to add them as a contact.
Add a contact
diff --git a/briar-android/src/net/sf/briar/android/helloworld/HelloWorldService.java b/briar-android/src/net/sf/briar/android/BriarService.java
similarity index 81%
rename from briar-android/src/net/sf/briar/android/helloworld/HelloWorldService.java
rename to briar-android/src/net/sf/briar/android/BriarService.java
index ed00b0625..d2aff0514 100644
--- a/briar-android/src/net/sf/briar/android/helloworld/HelloWorldService.java
+++ b/briar-android/src/net/sf/briar/android/BriarService.java
@@ -1,4 +1,4 @@
-package net.sf.briar.android.helloworld;
+package net.sf.briar.android;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
@@ -6,6 +6,7 @@ import static java.util.logging.Level.WARNING;
import java.io.IOException;
import java.util.logging.Logger;
+import net.sf.briar.R;
import net.sf.briar.api.crypto.KeyManager;
import net.sf.briar.api.db.DatabaseComponent;
import net.sf.briar.api.db.DbException;
@@ -13,13 +14,14 @@ import net.sf.briar.api.plugins.PluginManager;
import roboguice.service.RoboService;
import android.content.Intent;
import android.os.IBinder;
+import android.support.v4.app.NotificationCompat;
import com.google.inject.Inject;
-public class HelloWorldService extends RoboService {
+public class BriarService extends RoboService {
private static final Logger LOG =
- Logger.getLogger(HelloWorldService.class.getName());
+ Logger.getLogger(BriarService.class.getName());
@Inject private DatabaseComponent db;
@Inject private KeyManager keyManager;
@@ -29,6 +31,13 @@ public class HelloWorldService extends RoboService {
public void onCreate() {
super.onCreate();
if(LOG.isLoggable(INFO)) LOG.info("Created");
+ NotificationCompat.Builder b = new NotificationCompat.Builder(this);
+ b.setSmallIcon(R.drawable.notification_icon);
+ b.setContentTitle(getText(R.string.notification_title));
+ b.setContentText(getText(R.string.notification_text));
+ b.setOngoing(true);
+ startForeground(1, b.build());
+ if(LOG.isLoggable(INFO)) LOG.info("Running in the foreground");
new Thread() {
@Override
public void run() {
@@ -45,7 +54,6 @@ public class HelloWorldService extends RoboService {
@Override
public IBinder onBind(Intent intent) {
- if(LOG.isLoggable(INFO)) LOG.info("Bound");
return null;
}
diff --git a/briar-android/src/net/sf/briar/android/helloworld/HelloWorldActivity.java b/briar-android/src/net/sf/briar/android/helloworld/HelloWorldActivity.java
index 98f9e52d5..afa9c32e8 100644
--- a/briar-android/src/net/sf/briar/android/helloworld/HelloWorldActivity.java
+++ b/briar-android/src/net/sf/briar/android/helloworld/HelloWorldActivity.java
@@ -9,6 +9,7 @@ import static java.util.logging.Level.INFO;
import java.util.logging.Logger;
import net.sf.briar.R;
+import net.sf.briar.android.BriarService;
import net.sf.briar.android.invitation.AddContactActivity;
import roboguice.activity.RoboActivity;
import android.content.Intent;
@@ -56,7 +57,7 @@ implements OnClickListener {
setContentView(layout);
- startService(new Intent(HelloWorldService.class.getName()));
+ startService(new Intent(BriarService.class.getName()));
}
@Override