Is it possible for a service to check the following
- Whether a App is running or not?
- If yes, is it App running is background or foreground? Please suggest some way to do it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to use getRunningTasks to know whether the app is running or not.
From the docs:
public List getRunningTasks (int maxNum)
Return a list of the tasks that are currently running, with the most recent being first and older ones after in order.
For this to work you should include this in your AndroidManifest.xml
And regarding App running background/foreground refer this LINK