How to check android service is running in background or foreground using command ?
Asked
Active
Viewed 773 times
1
-
may be it'll help you :https://stackoverflow.com/a/5921190.Please post your error or more information about it so the community will help you. – Viral Patel Dec 19 '19 at 05:43
-
@ViralPatel The linked question asks about how to determine if a `Service` is running programatically. OP wants to know how to determine this using `adb` command. – David Wasser Dec 19 '19 at 13:56
1 Answers
4
You can use adb shell dumpsys activity services
Foreground services should have isForeground=true
in the output

David Wasser
- 93,459
- 16
- 209
- 274
-
If the answer was helpful, you should accept it by clicking the green checkmark. Or do you still have questions about this? – David Wasser Dec 23 '19 at 08:29
-
this is giving all services on my device but Is it possible to do only my app? – mbpatel Mar 31 '22 at 13:16
-
@mbpatel You can append your package name to the command, like this: `adb shell dumpsys activity services com.mycompany.mypackage` – David Wasser Mar 31 '22 at 13:26