android check if app is running

Solutions on MaxInterview for android check if app is running by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "android check if app is running"
Magdalena
30 Oct 2016
1private fun isAppRunning() : Boolean {
2        val services = (getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager).runningAppProcesses
3        return services.firstOrNull{it.processName.equals(packageName,true)} != null
4    }