mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2024-11-09 20:11:01 +00:00
1. Service status fix #48
This commit is contained in:
parent
35c5dd3ba1
commit
259aa4cbc8
@ -8,8 +8,8 @@ android {
|
|||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
||||||
versionCode 30
|
versionCode 32
|
||||||
versionName "2.0.12"
|
versionName "2.0.14"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
setProperty("archivesBaseName", project.getParent().name+"-"+versionName)
|
setProperty("archivesBaseName", project.getParent().name+"-"+versionName)
|
||||||
}
|
}
|
||||||
|
@ -398,6 +398,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
//TODO reimplement it
|
//TODO reimplement it
|
||||||
private fun isYggServiceRunning(context: Context): Boolean {
|
private fun isYggServiceRunning(context: Context): Boolean {
|
||||||
|
if(this.intent.hasExtra(YggdrasilTunService.IS_VPN_SERVICE_STOPPED)){
|
||||||
|
return !this.intent.getBooleanExtra(YggdrasilTunService.IS_VPN_SERVICE_STOPPED, true)
|
||||||
|
}
|
||||||
val manager =
|
val manager =
|
||||||
context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
||||||
for (service in manager.getRunningServices(Int.MAX_VALUE)) {
|
for (service in manager.getRunningServices(Int.MAX_VALUE)) {
|
||||||
|
@ -42,6 +42,7 @@ class YggdrasilTunService : VpnService() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "Yggdrasil-service"
|
private const val TAG = "Yggdrasil-service"
|
||||||
|
public const val IS_VPN_SERVICE_STOPPED = "VPN_STATUS"
|
||||||
}
|
}
|
||||||
|
|
||||||
private val FOREGROUND_ID = 1338
|
private val FOREGROUND_ID = 1338
|
||||||
@ -273,6 +274,7 @@ class YggdrasilTunService : VpnService() {
|
|||||||
""
|
""
|
||||||
}
|
}
|
||||||
var intent = Intent(this, MainActivity::class.java)
|
var intent = Intent(this, MainActivity::class.java)
|
||||||
|
intent.putExtra(IS_VPN_SERVICE_STOPPED, isClosed);
|
||||||
var stackBuilder = TaskStackBuilder.create(this)
|
var stackBuilder = TaskStackBuilder.create(this)
|
||||||
stackBuilder.addNextIntentWithParentStack(intent)
|
stackBuilder.addNextIntentWithParentStack(intent)
|
||||||
var pi = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
var pi = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||||
|
Loading…
Reference in New Issue
Block a user