How can I get the current focus in my service.
I found several ways to do this, such as Activity.getCurrentFocus () and Windows.getCurrentFocus (). But these methods are used in Activities.
If I want to use them, I have to get the current focus activity. I tried using WindowManager to complete the current task. Thus, he received only the current name of the class Activity. not an activity object.
List<RunningAppProcessInfo> rList =activityManager.getRunningAppProcesses(); RunningTaskInfo rt = rtList.get(0); rt.topActivity.getClassName();
How can I use these methods to get the current focus in Service? Or is there another way to do it?
source share