Trigger update of ScanResult android wifi - android

Is it possible to trigger an update of the scan result for wifi on an Android phone? So when you use the example code below you dont get cashed values.
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
List<ScanResult> results = wifiManager.getScanResults();

WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifiManager.startScan();
List<ScanResult> results = wifiManager.getScanResults();

Related

Android SupplicantState returns COMPLETED after disconnecting from network

The problem:
When I connect to wifi, and then disconnect, the following code gives me SupplicantState.COMPLETED
SupplicantState supState;
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
supState = wifiInfo.getSupplicantState();

Forgot network not working in Android Marshmallow?

I am using below code to remove or forgot configure Wi-Fi network:
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifiManager.removeNetwork(networkID);
but its not working in os 6.0, please suggest?
You should use like this:
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
int networkId = wifiManager.getConnectionInfo().getNetworkId();
wifiManager.removeNetwork(networkId);
wifiManager.saveConfiguration();
Hope it will helps you !!

how to check WiFi connection is automatic or established manually in android?

I am doing a small android application, which will show established WiFi connection is automatic or Manuel. Is it possible to take WiFi access point which is set by user in default "setting" application?
Thanks, Vani
see this
[ www.developer.android.com/reference/android/net/wifi/package-summary.html]
or
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifiManager != null) {
WifiInfo info = wifiManager.getConnectionInfo();
if (info != null) {
String ssid = info.getSSID();
...
}
}

how to get MacID of mobiledevice in android?

how to get MacID of mobiledevice in android?
try this
WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = manager.getConnectionInfo();
String MACAddress = wifiInfo.getMacAddress();

how to get macid and mobile number only in android mobile device not in database

how to get macid and mobile number only in android mobile device not in database
try this
WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = manager.getConnectionInfo();
String MACAddress = wifiInfo.getMacAddress();

Categories

Resources