3

I want to write an android service at is activated when the internet connection goes down, and displays another activity to user when that happens. I don't know how to start to write this service. Can any one give me an idea or better tutorial how to catch the connection down within Android service.

Thanks

wojciii
  • 4,253
  • 1
  • 30
  • 39
iDia
  • 1,397
  • 8
  • 25
  • 44
  • if u have connection problem to refer this link: http://stackoverflow.com/questions/5165099/android-how-to-handle-change-in-network-from-gprs-to-wi-fi-and-vice-versa-whi – XEME Jul 20 '12 at 13:53

2 Answers2

2

When Internet connectivity changes, the system sends out a broadcast with an android.net.conn.CONNECTIVITY_CHANGE intent. You should be able to create a broadcast receiver that will be called whenever the device is connected or loses its connection.

Frxstrem
  • 38,761
  • 9
  • 79
  • 119
1

You've to write a receiver for the connection changes.

You can look right here : Android, How to handle change in network (from GPRS to Wi-fi and vice-versa) while polling for data

Community
  • 1
  • 1
shemsu
  • 1,066
  • 9
  • 17