wifimanager

What interval should I use between each WiFi scan on Android?

北城以北 提交于 2019-12-30 02:23:04
问题 I need to perform Wifi scans at regular intervals. I am encountering a problem when the time interval is set to 1-2 seconds. It seems like I am not getting any ScanResult . Is there a minimum amount of time to set so that the WifiManager is able to perform a successful WiFi scan? Here is the code. I am using a Service to do the Wifi scan: public class WifiScanning extends Service{ private static final String TAG = "WifiScanning"; private Timer timer; public int refreshRate, numberOfWifiScan,

Get Devices connected to same wifi network in android programmatically?

偶尔善良 提交于 2019-12-25 18:38:06
问题 I am developing an app in which the first thing i need is how to get devices that are connected to my wifi network or same wifi network .ie ip adress,device name etc. I don't have any idea how to do that have searched alot but there are no examples available. I have done one thing that i will ping 255 ips and whichever will respond will be the connected ips but the problem here is that there are virtual ips already assigned to some websites so i need to detect only the real device ip

How do I program android to look for a particular network? (Issues Following Simple Tutorial)

纵然是瞬间 提交于 2019-12-25 06:37:58
问题 I'm attempting to use the following example: How do I program android to look for a particular network? But I'm unable to execute it due to issues stemming from the line: WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); After that I'm getting several other errors - but [I think] I've followed the tutorial/example precisely. import java.util.List; import android.app.Activity; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager;

How connect Android to no SSID public and no Password requered

百般思念 提交于 2019-12-25 05:36:13
问题 i can't connect Android on SSID established, i try WifiConfiguration but unsucessfull, my ssid is open (without password). In Android UI i can connect, but on code i can't. Anybody help me? Tankyou. EDIT: my code: String networkSSID = "DL63.0.0.0.1"; String networkPass = ""; WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" + networkSSID + "\""; // conf.wepKeys[0] = "\"" + networkPass + "\""; // conf.wepTxKeyIndex = 0; conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt

Sleep command for Android

梦想与她 提交于 2019-12-25 03:13:34
问题 I am writing a small program to periodically poll the RSSI of the WIFI connection. I am using SystemClock.Sleep(2000) in the program. The problem, I would like to display the RSSI every 2 seconds. But, currently, even though it polls every 2 seconds, the result is displayed only at the end of the loop. Here is the code snippet: for(int i=0;i<10;i++) { Date dt=new Date(); WifiInfo info = wifi.getConnectionInfo(); int rssi = info.getRssi(); textStatus.append("\n\nRSSI :" +Integer.toString(rssi)

Sleep command for Android

谁说胖子不能爱 提交于 2019-12-25 03:13:27
问题 I am writing a small program to periodically poll the RSSI of the WIFI connection. I am using SystemClock.Sleep(2000) in the program. The problem, I would like to display the RSSI every 2 seconds. But, currently, even though it polls every 2 seconds, the result is displayed only at the end of the loop. Here is the code snippet: for(int i=0;i<10;i++) { Date dt=new Date(); WifiInfo info = wifi.getConnectionInfo(); int rssi = info.getRssi(); textStatus.append("\n\nRSSI :" +Integer.toString(rssi)

Connect to strongest access point (access point with the strongest signal) with the same SSID

◇◆丶佛笑我妖孽 提交于 2019-12-24 00:37:54
问题 I am writing a program to always connect to the strongest access point. I mean the access point with the strongest signal. First I scan all the available WiFi networks and then I restrict them to see just the ones with the same SSID. So I can see all the APs of one network. When I connect to that network it doesn't connect to the strongest signal but I want it to switch to the strongest AP signal. By WifiManager.compareSignalLevel(bestSignal.level, connectedAP.level) <0 I understand the best

android.net.wifi.STATE_CHANGE not broadcasting when wifi get enabled and WifiManager.EXTRA_WIFI_STATE not available

老子叫甜甜 提交于 2019-12-24 00:23:11
问题 Manifest: <receiver android:name=".triggers.WifiTrigger"> <intent-filter> <action android:name="android.net.wifi.STATE_CHANGE" /> </intent-filter> </receiver> Permissions : <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android

How to check Wi-Fi connection (SSID) when connected to MOBILE at the same time on Android

醉酒当歌 提交于 2019-12-24 00:13:52
问题 I am having some strange issues when I want to verify, whether an Android device is connected to a specific Wi-Fi (identified by SSID) AND it has a MOBILE data network active at the same time. It is also likely that my issue is connected to Android 9 (SDK 28), as I did not get any complaints from users with previous Android versions. So here is what I have: This is my main method, that should tell me whether the device is currently connected to it's target Wi-Fi: public boolean

How to synchronize WifiManager.startscan() and WifiManager.getScanResults?

丶灬走出姿态 提交于 2019-12-23 04:38:33
问题 I am trying to scan for access points every second. Here's what I am doing. if (isScanning()) { new Timer().schedule(new TimerTask() { @Override public void run() { results = manager.getScanResults(); manager.startScan(); } }, 0,1000); adapter.notifyDataSetChanged(); I am displaying the results using a BaseAdapter. public View getView(int position, View convertView, ViewGroup parent) { ScanResult result = results.get(position); if (convertView == null) { LayoutInflater inflater =