I want to make an Android service that will run in the background and be able to get the name of the currently running activity. Does anyone know how to do this?
Check this answer: 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.