android-wifi

Android, automatically connecting to wifi networks that have no internet access

我们两清 提交于 2019-12-25 09:12:02
问题 I'm calling the function WifiManager.addNetwork(WifiConfiguration) to try and add an adhoc wifi network to the device's wifi configurations. But on Android M this function returns -1, I'm assuming because it doesn't have internet access. It works fine on most other devices. Below is code snippet I'm using. WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.SSID = '\"' + ssid + '\"'; wifiConfiguration.hiddenSSID = false; wifiConfiguration.allowedKeyManagement.set

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

Android: Establish “Wi-Fi Direct” connection with networked devices

旧巷老猫 提交于 2019-12-25 04:06:40
问题 Was going through Android documentation and had few doubts: Using "Wi-Fi direct" in Android 4.0+, is it possible to establish connection pragmatically with NON "Wi-Fi direct" enabled network device? For example, is it possible to communicate with older smartphone (having Android 2.2 OS) with the latest 4.1 based Android Smartphone. I want to use Wi-Fi direct capablities to perform FTP operation on various kinds of smartphones (android, iOS) Thanks. 回答1: I am using an APP named FileDrop which

Android WiFi can't get the SSID and BSSID from ScanResult

柔情痞子 提交于 2019-12-24 17:27:32
问题 I got this code that i want to scan for the networks and then write it all to the listview. But the problem is that the ssid and bssid doesnt show. Everything else shows but not the ssid. Also what is the best way to update the listview every second so you can see the signal strenghts actual signal? import java.util.List; import android.annotation.SuppressLint; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent;

Create WifiConfiguration with Delphi XE5 for Android

亡梦爱人 提交于 2019-12-24 01:43:46
问题 I'm trying to create a WifiConfiguration for Android. All other properties can be set. But if i try to set the SSID or BSSID, i'm getting a segmentation fault (11) and the app and Delphi just hangs. var WIFIConfig: JWifiConfiguration; begin WIFIConfig := TJWifiConfiguration.JavaClass.init; WIFIConfig.hiddenSSID := false; -> works WIFIConfig.SSID := StringtoJString('"YOUR_WLAN_SSID"'); -> App just hangs end; http://developer.android.com/reference/android/net/wifi/WifiConfiguration.html

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

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

failed to connect to specific WiFi in android programmatically

北城余情 提交于 2019-12-23 15:49:08
问题 I'm using the following code to detect and connect to specific WiFi ssid when I press a button in android. Below is the code. Any help will be appreciated. ssid :- "myHotspot" & password:- "12345678" Button b1 = (Button) findViewById(R.id.button); <br> b1.setOnClickListener(new View.OnClickListener() { <br><br>@Override <br>public void onClick(View v) { wifiConfiguration.SSID = "\"myHotspot\""; wifiConfiguration.preSharedKey ="\"12345678\""; WifiManager wifiManager = (WifiManager)

How to determine the network unavailability in android

旧城冷巷雨未停 提交于 2019-12-23 05:25:58
问题 I want to show alert that connection not available in my android application. I am calling some rest request in my application. To check this network unavailability scenario I manually disconnect my wifi in my laptop (I am testing in simulator) . Code where I call service is here resp = client.execute(httpPostRequest); and here I am catching exception catch (IllegalStateException e) { //assertTrue(e.getLocalizedMessage(), false); e.printStackTrace(); } catch (ClientProtocolException e) { /

Checking if programm has the internet over wifi

£可爱£侵袭症+ 提交于 2019-12-23 04:25:06
问题 After reading some answers and trying to use them I still can not make my code return a correct state, if there is internet over wifi or not. I must "ping" over WIFI, because we may be connected to the Access Point with no further internet connection. Here is a complete code. ConnectivityManager CM = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo NI = CM.getActiveNetworkInfo(); boolean IC = false; IC = CM.requestRouteToHost(ConnectivityManager.TYPE