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...
Asked
Active
Viewed 153 times
0
-
Check connection state.And if it is regained show notification about it – Yahor10 Nov 27 '12 at 06:36
-
Other than using a service, is there any way by using broadcast receiver? – Justin Aloor Nov 27 '12 at 06:40
-
You can fire notification any where – Yahor10 Nov 27 '12 at 06:43
1 Answers
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