0

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..

abbas.aniefa
  • 2,855
  • 21
  • 30
  • It is as simple as invoking your task/method in the onReceive() of your receiver. Are you looking for anything special? – chedine Jul 21 '11 at 06:26

1 Answers1

0

I have paste some code which shows how to check for running services here. If you looking for activity use RunningTaskInfo instead of RunningServicesInfo.

Community
  • 1
  • 1
piotrpo
  • 12,398
  • 7
  • 42
  • 58