Skip to content
Snippets Groups Projects
Commit 49e6113e authored by akwizgran's avatar akwizgran
Browse files

Allow binding to the local BriarService instance.

parent 00c0729f
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ import net.sf.briar.api.db.DbException;
import net.sf.briar.api.plugins.PluginManager;
import roboguice.service.RoboService;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
......@@ -23,6 +24,8 @@ public class BriarService extends RoboService {
private static final Logger LOG =
Logger.getLogger(BriarService.class.getName());
private final Binder binder = new BriarBinder();
@Inject private DatabaseComponent db;
@Inject private KeyManager keyManager;
@Inject private PluginManager pluginManager;
......@@ -49,12 +52,12 @@ public class BriarService extends RoboService {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if(LOG.isLoggable(INFO)) LOG.info("Started");
return 0;
return START_STICKY;
}
@Override
public IBinder onBind(Intent intent) {
return null;
return binder;
}
@Override
......@@ -102,4 +105,11 @@ public class BriarService extends RoboService {
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
}
}
public class BriarBinder extends Binder {
BriarService getService() {
return BriarService.this;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment