Support
Quality
Security
License
Reuse
kandi has reviewed free-wireless-hdmi and discovered the below as its top functions. This is intended to give you an instant insight into free-wireless-hdmi implemented functionality, and help decide if they suit your requirements.
Turn your wifi-enabled Camera into a wireless webcam for youtube, etc.
No Code Snippets are available at this moment for free-wireless-hdmi.Refer to component home page for details.
No Code Snippets are available at this moment for free-wireless-hdmi.Refer to component home page for details.
QUESTION
Is it possible to make WIFI scanner on android with API level 29+?
Asked 2022-Apr-05 at 08:31Even with all the permissions granted the startScan() function still returns false. So my question is: is there a way to scan access points on android 29 or higher?
ANSWER
Answered 2022-Apr-05 at 08:31The problem was in asking the user for permission. My working code
-Manifest:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
-And for asking user for permissions I used EasyPermissions:
boolean scanWifi(WifiManager wifiManagerToScan) {
String[] perm = {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.CHANGE_WIFI_STATE};
if (EasyPermissions.hasPermissions(this, perm)) {
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
boolean scanStarted = wifiManagerToScan.startScan();
if (scanStarted) {
Toast.makeText(this, "Scanning...", Toast.LENGTH_SHORT).show();
return true;
} else {
Toast.makeText(this, "ERROR", Toast.LENGTH_SHORT).show();
return false;
}
}
else {
EasyPermissions.requestPermissions(this, "WE REQUIRE THESE PERMISSIONS FOR THE APP TO FUNCTION", 123, perm);
return false;
}
}'
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Explore Related Topics