We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3d11f5f commit 565f4e0Copy full SHA for 565f4e0
1 file changed
core/firebase/src/main/java/com/terning/core/firebase/messageservice/TerningMessagingService.kt
@@ -136,10 +136,11 @@ class TerningMessagingService : FirebaseMessagingService() {
136
private fun isAppInForeground(): Boolean {
137
val appProcesses =
138
(getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager).runningAppProcesses
139
- val packageName = packageName
140
return appProcesses?.any {
141
- it.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND &&
142
- it.processName == packageName
+ val isForeground =
+ it.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND
+ val isCurrentApp = it.processName == packageName
143
+ isForeground && isCurrentApp
144
} == true
145
}
146
0 commit comments