开发者

Send notifications only when activity is in background

开发者 https://www.devze.com 2023-02-14 22:53 出处:网络
I need a way to determine whether ativity active or 开发者_运维问答in the background. I have a service which notifies user, but I want to do it only when activity is inactive.

I need a way to determine whether ativity active or 开发者_运维问答in the background. I have a service which notifies user, but I want to do it only when activity is inactive. I might use global variables, set them in onStop() for example, but is there any other way?


Have you try to do it with ActivityManager#getRunningAppProcesses() took the idea directly from How to determine if one of my activities is in foreground

0

精彩评论

暂无评论...
验证码 换一张
取 消