我想制作一个将在后台运行并能够获取当前正在运行的 Activity 名称的 Android 服务。有谁知道如何做到这一点?
最佳答案
检查这个答案:https://stackoverflow.com/a/6881991/198996
Try using getRunningAppProcesses() to get a list of RunningAppProcessInfo. Then go through each RunningAppProcessInfo and check if it is in the foreground
关于java - Android - 当前正在运行的 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16247273/