I have a registered Broad Cast receiver in my app to store USB connected/disconnected state in Shared Preferences. Its working Fine.
Now i wanted to perform a task immediately if USB connected and my application is running. how can i do this?
If my application is not running , i ll perform the task in my first activity based on the Shared Preference value.
Please give some ideas to do this..
I have paste some code which shows how to check for running services here.
If you looking for activity use RunningTaskInfo instead of RunningServicesInfo.