Javatpoint Logo
Javatpoint Logo

Android Wifi Example

The android.net.wifi.WifiManager class can be used to manage the wifi connectivity. It can be used to add network, disable network, scan for access points, disconnect etc.

Android wifi example to enable and disable wifi

Let's see the simple example of wifi to enable and disable the wifi service.

activity_main.xml

File: activity_main.xml

Activity class

File: MainActivity.java

Add Permission in AndroidManifest.xml

You need to add following permissions in AndroidManifest.xml file.



Output:

android wifi example output 1





Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA