mirror of
https://github.com/go-i2p/i2p-android-sam.git
synced 2025-07-12 06:54:36 -04:00
oncreate fixup
This commit is contained in:
@ -90,6 +90,7 @@ public class SAMForegroundService extends Service {
|
||||
public Properties getRouterProperties() throws IOException {
|
||||
Properties router_properties = new Properties();
|
||||
router_properties.setProperty("i2p.dir.base", getFilesDir().getAbsolutePath());
|
||||
//router_properties.setProperty("i2p.routerconsole", "false");
|
||||
// disable router console and all apps except for i2cp
|
||||
return router_properties;
|
||||
}
|
||||
@ -162,7 +163,21 @@ public class SAMForegroundService extends Service {
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
new StartupTask().execute(intent);
|
||||
return START_NOT_STICKY;
|
||||
try {
|
||||
if (router == null) {
|
||||
router = new Router();
|
||||
router.setKillVMOnEnd(false);
|
||||
router.runRouter();
|
||||
Log.i("SAMForegroundService", "I2P Router started successfully");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("SAMForegroundService", "Failed to start I2P Router", e);
|
||||
stopSelf();
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
startForeground(1, notification.build());
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private class StartupTask extends AsyncTask<Intent, Void, Void> {
|
||||
|
Reference in New Issue
Block a user