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.
628 questions
308
votes
10 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,406
  • 5
  • 32
  • 45
245
votes
23 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
  • 30,406
  • 15
  • 78
  • 89
32
votes
3 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,423
  • 5
  • 23
  • 46
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
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,094
  • 3
  • 24
  • 49
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
  • 237
  • 1
  • 5
  • 8
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
  • 1,936
  • 2
  • 21
  • 37
18
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
  • 211
  • 1
  • 2
  • 9
18
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
  • 59,308
  • 24
  • 169
  • 227
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…
15
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.…
WonderfulMe
  • 654
  • 8
  • 25
14
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
  • 106,412
  • 122
  • 641
  • 1,128
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
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,133
  • 3
  • 17
  • 31
12
votes
2 answers

Android disconnects automatically from WiFi without internet below Android 10

Working on an android application in which I need to connect WiFi device programatically which does not have internet. Here is a code: private void connectToWiFi(final String ssid, String password) { if (Build.VERSION.SDK_INT <…
Khushbu Shah
  • 1,691
  • 3
  • 23
  • 41
1
2 3
41 42