| | |
| | | package com.runt.open.mvi.base |
| | | |
| | | import android.app.ActivityManager |
| | | import android.content.Context |
| | | import android.content.Intent |
| | | import android.content.pm.PackageManager |
| | |
| | | return result |
| | | } |
| | | |
| | | @Suppress("DEPRECATION") |
| | | protected fun isMyServiceRunning(serviceClass: Class<*>): Boolean { |
| | | val manager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager |
| | | for (service in manager.getRunningServices(Integer.MAX_VALUE)) { |
| | | if (serviceClass.name == service.service.className) { |
| | | return true |
| | | } |
| | | } |
| | | return false |
| | | } |
| | | |
| | | /** |
| | | * 检查权限 |