mirror of
https://github.com/dovecoteescapee/ByeDPIAndroid.git
synced 2024-11-20 12:34:39 +00:00
Merge pull request #50 from kaajjo/service-patch
fix: use `startForegroundService` instead of `startService`
This commit is contained in:
commit
4fdad0cfba
@ -3,6 +3,7 @@ package io.github.dovecoteescapee.byedpi.services
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import androidx.core.content.ContextCompat
|
||||
import io.github.dovecoteescapee.byedpi.data.Mode
|
||||
import io.github.dovecoteescapee.byedpi.data.START_ACTION
|
||||
import io.github.dovecoteescapee.byedpi.data.STOP_ACTION
|
||||
@ -16,14 +17,14 @@ object ServiceManager {
|
||||
Log.i(TAG, "Starting VPN")
|
||||
val intent = Intent(context, ByeDpiVpnService::class.java)
|
||||
intent.action = START_ACTION
|
||||
context.startService(intent)
|
||||
ContextCompat.startForegroundService(context, intent)
|
||||
}
|
||||
|
||||
Mode.Proxy -> {
|
||||
Log.i(TAG, "Starting proxy")
|
||||
val intent = Intent(context, ByeDpiProxyService::class.java)
|
||||
intent.action = START_ACTION
|
||||
context.startService(intent)
|
||||
ContextCompat.startForegroundService(context, intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,14 +36,14 @@ object ServiceManager {
|
||||
Log.i(TAG, "Stopping VPN")
|
||||
val intent = Intent(context, ByeDpiVpnService::class.java)
|
||||
intent.action = STOP_ACTION
|
||||
context.startService(intent)
|
||||
ContextCompat.startForegroundService(context, intent)
|
||||
}
|
||||
|
||||
Mode.Proxy -> {
|
||||
Log.i(TAG, "Stopping proxy")
|
||||
val intent = Intent(context, ByeDpiProxyService::class.java)
|
||||
intent.action = STOP_ACTION
|
||||
context.startService(intent)
|
||||
ContextCompat.startForegroundService(context, intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user