Monitor Currently Running Application

后端 未结 1 1772
轮回少年
轮回少年 2021-01-27 15:49

I am encountering a problem that i can\'t not solve for the moment.
The purpose of the code is to monitor which applications are running at current moment.
I used the fo

1条回答
  •  迷失自我
    2021-01-27 16:31

    replace the "Activity" in getSystemService's parameters with "Context":

    ActivityManager  manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    

    I tested it and works fine for me!

    0 讨论(0)
提交回复
热议问题