Questions tagged [wifimanager]

WifiManager is the primary Android API for managing all aspects of Wi-Fi connectivity.

WifiManager is the primary Android API for managing all aspects of Wi-Fi connectivity.

As per the WifiManager documentation, this class provides access to:

  • The list of configured networks. The list can be viewed and updated, and attributes of individual entries can be modified.
  • The currently active Wi-Fi network, if any. Connectivity can be established or torn down, and dynamic information about the state of the network can be queried.
  • Results of access point scans, containing enough information to make decisions about what access point to connect to.
  • It defines the names of various Intent actions that are broadcast upon any sort of change in Wi-Fi state.
667 questions
319
votes
11 answers

How do I connect to a specific Wi-Fi network in Android programmatically?

I want to design an app which shows a list of Wi-Fi networks available and connect to whichever network is selected by the user. I have implemented the part showing the scan results. Now I want to connect to a particular network selected by the user…
Vikram Gupta
  • 6,496
  • 5
  • 34
  • 47
255
votes
24 answers

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

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 still have a 3G connection. android.net.wifi.WifiManager m = (WifiManager)…
Nathan Schwermann
  • 31,285
  • 16
  • 80
  • 91
38
votes
4 answers

How to get available wifi networks and display them in a list in android

Friends, I want to find all available WiFi networks and display them in a list I have tried as below. But it's not working. I have edited my code, and now I got the result but with all the result that I don't need. I only need names of wifi network…
jigar
  • 1,571
  • 6
  • 23
  • 46
24
votes
6 answers

Android get IP-Address of a hotspot providing device

I'm currently using public static String getLocalIPAddress(WifiManager wm){ return Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress()); } to get the IP-Address of the executing devices. That works fine if the device is connected…
user2224350
  • 2,262
  • 5
  • 28
  • 54
23
votes
5 answers

Android WifiManager.addNetwork() returns -1

I am writing an android app which will connect to a specific WPA access point, when connected, it will issue a http call. It will not save the network config. I have read almost every post on stack overflow on connecting to wifi network but can't…
Mukesh Aggarwal
  • 241
  • 1
  • 2
  • 5
21
votes
2 answers

Get the current speed of internet (mobile & Wifi) using Android

I have an app that has to work in offline and online mode. Application has to make requests to the app server based on the internet speed of the current network connection (Wifi or Data). If Wifi is connected, I can get the Wifi signal strength of…
user198530
  • 331
  • 1
  • 3
  • 10
20
votes
6 answers

How to get each device's IP address in Wi-Fi Direct scenario?

Starting from ICS, Wi-Fi Direct is introduced. Normally, we use the WifiP2pManager class to operate on Wi-Fi Direct, but it seems that it can only retrieve the GroupOwner IP address after connected. But, actually, any device all came negotiate to…
nicefuture
  • 257
  • 1
  • 5
  • 8
19
votes
3 answers

Prevent Android phone from connecting to WiFi network unless my app approves it?

I want to develop an app that can prevent connection to a WiFi network unless I approve it. I want to be able to query the MAC address of the access point and compare that to a list of known addresses corresponding to SSIDs. The goal of the app is…
Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
19
votes
2 answers

Get Wi-Fi protocol (802.11a/b/g/n) programmatically

Through WifiManager, my Android app can get a lot of details about Wi-Fi. However I fail to get protocol type like a/b/g/n. I have a client requirement to do that. Does anyone know how to achieve that? (I don't have the option to use adb). It is to…
TorukMakto
  • 2,066
  • 2
  • 24
  • 38
17
votes
4 answers

Is it possible to add a network configuration on Android Q?

Background I've noticed that in WifiManager class there is a function called addNetwork, that might be useful if I want to restore or save networks information (network name AKA SSID, together with the password and the type), so that I could also…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
16
votes
3 answers

Set static IP and gateway programmatically in Android 6.x (Marshmallow)

Can anybody tell me how can I set the static IP and gateway programmatically in Android 6? I have read here and here. Settings.System is not working anymore and goolgle says WIFI_STATIC_IP was deprecated in API level 17 and Use WifiManger instead.…
mohsen_og
  • 774
  • 1
  • 9
  • 31
16
votes
1 answer

How to be notified when a peer is no longer available in the Wi-Fi Direct range?

I am developing an Android application based on the use of Wifi Direct API. I have registered in my Activity a BroadcastReceiver in order to be notified about the following Wifi Direct events: WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION…
13
votes
0 answers

Why WifiConfiguration.BSSID is always null?

I'm reading existing Wi Fi configuration. Code is pretty decent WifiManager wifiMgr = (WifiManager) getSystemService(Context.WIFI_SERVICE); List configurations= null; if (wifiMgr != null) { configurations =…
dmitry.tcheban
  • 191
  • 1
  • 10
13
votes
4 answers

Oreo Wifi Connectivity

I am working on an IoT app in which there is an on boarding process where the user connects to an access point, which has not internet connectivity, configure the device and then connects to his home Wifi network. Android 8 devices have been causing…
Digital Da
  • 891
  • 1
  • 10
  • 23
13
votes
2 answers

Android Wi-Fi Direct read rssi signal strength

I need to measure Wi-Fi Direct signal(RSSI signal) between two Android mobile phones. How i can do that?
userInThisWorld
  • 1,361
  • 4
  • 18
  • 35
1
2 3
44 45