Commit 5f43500b authored by Max Lv's avatar Max Lv

Fix auto-start again

parent 8b4a8a92
...@@ -54,11 +54,13 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext { ...@@ -54,11 +54,13 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext {
} }
override def onServiceConnected() { override def onServiceConnected() {
if (bgService != null) { handler.postDelayed(() => {
if (app.isNatEnabled) startBackgroundService() if (bgService != null) {
else if (VpnService.prepare(ShadowsocksRunnerService.this) == null) startBackgroundService() if (app.isNatEnabled) startBackgroundService()
handler.postDelayed(() => stopSelf(), 10000) else if (VpnService.prepare(ShadowsocksRunnerService.this) == null) startBackgroundService()
} handler.postDelayed(() => stopSelf(), 10000)
}
}, 1000)
} }
def startBackgroundService() = bgService.useSync(app.profileId) def startBackgroundService() = bgService.useSync(app.profileId)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment