Answers for "service running control kotlin"

1

service running control kotlin

fun Context.isMyServiceRunning(serviceClass: Class<*>): Boolean {
    val manager = this.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
    return manager.getRunningServices(Integer.MAX_VALUE)
            .any { it.service.className == serviceClass.name }
}
Posted by: Guest on August-03-2021

Code answers related to "service running control kotlin"

Browse Popular Code Answers by Language