How to check Wifi is connected, but no Internet access in Android

后端 未结 4 1952
挽巷
挽巷 2020-12-28 19:35

I would like to know why wifi is connected but there is no internet access in Android. How can i check it? My code is:

ConnectivityManager cn=(ConnectivityMa         


        
4条回答
  •  悲哀的现实
    2020-12-28 19:45

    In addition to what you are doing right now,you can use BroadcastReceiver for your application to get notified whenever the connectivity changes by registering intent.

    Have a look at docs: BroadcastReceiver and Connectivity Monitoring for detailed description.

    I hope it will be helpful !

提交回复
热议问题