I am working on push notification in android where i am using a below method to show notification, but the problem is that now ActivityManager.getRunningTasks(1); is being
in Kotlin
fun isAppRunning(context: Context): Boolean {
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
return activityManager.appTasks
.filter { it.taskInfo != null }
.filter { it.taskInfo.baseActivity != null }
.any { it.taskInfo.baseActivity.packageName == context.packageName }
}