Dapatkan daftar aplikasi terbuka saat ini di Kotlin
val am = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val runningAppProcessInfo = am.runningAppProcesses
// detect an app
for (i in runningAppProcessInfo.indices) {
if (runningAppProcessInfo[i].processName == "com.the.app.you.are.looking.for") {
// Do your stuff here.
}
}
Hjmcoder