How do I see if Wi-Fi is connected on Android?

前端 未结 22 2918
挽巷
挽巷 2020-11-22 05:56

I don\'t want my user to even try downloading something unless they have Wi-Fi connected. However, I can only seem to be able to tell if Wi-Fi is enabled, but they could sti

22条回答
  •  甜味超标
    2020-11-22 06:17

    This is an easier solution. See Stack Overflow question Checking Wi-Fi enabled or not on Android.

    P.S. Do not forget to add the code to the manifest.xml file to allow permission. As shown below.

    
    
    
    
    
    
    

提交回复
热议问题