Broadcast Receiver and Internet connection

前端 未结 2 1375
忘掉有多难
忘掉有多难 2020-12-18 14:04

How do I use broadcast receiver to check if there isn\'t Internet connection?

And after that:

1.If there is connection = do nothing

2.There isn\'t co

2条回答
  •  有刺的猬
    2020-12-18 15:03

    ConnectivityManager provides calls by which you can check for internet connectivity.

    If you want to listen for a change in connectivity, create a listener that reacts to ConnectivityManager.CONNECTIVITY_ACTION

提交回复
热议问题