mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-27 05:23:00 +00:00
service tests
This commit is contained in:
parent
985999899b
commit
7bdbf6e9b5
1 changed files with 2 additions and 3 deletions
|
@ -25,10 +25,9 @@ object AppUtils {
|
||||||
private fun isServiceRunning(cls: Class<out Service>, context: Context): Boolean {
|
private fun isServiceRunning(cls: Class<out Service>, context: Context): Boolean {
|
||||||
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
||||||
val runningServices = activityManager.getRunningServices(Int.MAX_VALUE)
|
val runningServices = activityManager.getRunningServices(Int.MAX_VALUE)
|
||||||
runningServices.forEach { info ->
|
return runningServices.any { info ->
|
||||||
return info.service.className == cls.name
|
info.service.className == cls.name
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendFailure(status: Int, context: Context) {
|
fun sendFailure(status: Int, context: Context) {
|
||||||
|
|
Loading…
Reference in a new issue