0

My application has to update the server frequently, so, I run a service which checks whether or not the device is on coverage area, using ConnectivityManager and NetworkInfo, in every 3 minutes. It works fine... My doubt is, how to notify the user whenever the connectivity gets lost or regained? If there is an option for doing the updation automatically whenever the connectivity is regained, it will be great !!! Thanks in advance...

1 Answers1

0

You can use handler to display toast message to user

You can have notifications from the service to the activity by way of interface class.

You can also use broadcastreciever so when connectivity is lost you can receive broadcast in your application by registering to it and display toast message accordingly.

I suggest you use service with handler. For more info on handlers have a look a the link. http://www.vogella.com/articles/AndroidPerformance/article.html

Raghunandan
  • 132,755
  • 26
  • 225
  • 256