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
val cn: ComponentName
val am = applicationContext.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
cn = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
am.appTasks[0].taskInfo.topActivity
} else {
am.getRunningTasks(1)[0].topActivity
}