android how to get indicate when the internet connection is lost?

后端 未结 4 1055
忘掉有多难
忘掉有多难 2020-12-09 04:44

I\'m developing an android application and I want to get a notification when the internet (wifi or packet data connection) connection is lost. On my approach I can get the s

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-09 05:06

    You should use BroadcastReceivers for your requirement. Create a BroadcastReceiver which listen for network changes.

    Incase of any change in the network it will automatically fire the event and you can perform your operations regarding it.

提交回复
热议问题