mirror of
https://github.com/dovecoteescapee/ByeDPIAndroid.git
synced 2024-12-21 22:06:22 +00:00
fix: use startForegroundService
instead of startService
This commit is contained in:
parent
989156d3dd
commit
1494eadf9a
@ -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