android - How to check if Application is running or not in background -
i developing application in want start application on phone start , when application closed. when application starts start service or check in background after 1 minute if application running or not.
if application has been closed start application. have implemented first part using broadcast receivers. unable monitor application status in background.
i used services , created thread check application status (running or not) , service works when application running.
i need suggestions.
there no direct way figure when app gets in foreground or background. there possibility of reference counting in activities e.g. every onresume add +1 , on every onpause decrease 1. if count 0, whole app in background, if not it's in foreground.
Comments
Post a Comment