oncreate fixup

This commit is contained in:
eyedeekay
2025-06-30 14:07:02 -04:00
parent 09a107d4ea
commit 55063e10bd

View File

@ -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> {