android-wifi

Get WiFi's SSID without connecting to it?

旧街凉风 提交于 2019-12-02 07:09:33
I want to connect to a SSID wifi network in app. Code: WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" + networkSSID + "\""; But the problem is that I don't know the network SSID . How to get SSID of a WiFi Network without connecting to it? If you want to get all available wifi : List<ScanResult> mScanResults = mWifiManager.getScanResults(); If you want to connected wifi ssid : WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); Log.d("wifiInfo", wifiInfo.toString()); Log.d("SSID",wifiInfo.getSSID());

Can't connect to WiFi network

℡╲_俬逩灬. 提交于 2019-12-02 04:46:06
I am new to android development and was trying to connect to WiFi network using the Android SDK. The code for disconnect works fine but re-connection fails. Here's the code that i have try { WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" + networkSSID + "\""; // Please note the quotes. String should contain SSID in quotes conf.wepKeys[0] = password; //WEP password is in hex, we do not need to surround it with quotes. conf.wepTxKeyIndex = 0; conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);

32 - How to overcome the Wi-Fi Direct 32 limit on credentials in Android?

ε祈祈猫儿з 提交于 2019-12-02 04:05:32
See-> https://android.googlesource.com/platform/frameworks/base/+/b267554/wifi/java/android/net/wifi/p2p/WifiP2pGroupList.java#34 private static final int CREDENTIAL_MAX_NUM = 32; Which is essentially limiting the number of devices I can have connected in a single Wi-Fi Direct 'cloud' per se. This Question spawns from the answer and comments at https://stackoverflow.com/a/26242221/1815624 This Question is not a question of "How to" connect multiple device such as found at WiFi Direct for multiple devices CREDENTIAL_MAX_NUM is a limit on the number of WifiP2pGroup objects that the the

Android - force network requests go through wifi instead of mobile network

会有一股神秘感。 提交于 2019-12-02 00:31:36
I have an app which connects to a hardware device Wi-Fi hotspot. It seems that Android forward requests over other networks (3G/4G for example) instead the hotspot, since my hot spot has no internet connection. Is there any way to force network stream to work on the wifi? I've come across the following function, but it's deprecated: https://developer.android.com/reference/android/net/ConnectivityManager.html#setNetworkPreference(int) Per the Connecting your App to a Wi-Fi Device blog post : To direct all the network requests from your app to an external Wi-Fi device, call ConnectivityManager

getConnectionInfo() exception

孤人 提交于 2019-12-01 23:55:38
问题 Given this code: wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo info = wifi.getConnectionInfo(); ...and this line in the manifest: <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> I still get the exception: WifiService: Neither user 10057 nor current process has android.permission.ACCESS_WIFI_STATE. I am debugging on a Xoom, Honeycomb 3.1. If there is any other info that is needed, please ask. EDIT: added Manifest <?xml version="1.0" encoding="utf

Is using WakeLock overkill while using WifiLock on Android?

江枫思渺然 提交于 2019-12-01 20:05:06
My audio streaming app is working correctly with only WifiLock. But some devices report that when they turn off the screen, connection is cut and audio streaming is topped. (They say this does not happen on 3G) So, I thought maybe I can also use a Partial WakeLock. I am not sure if this fixes the issue but I think it is an option. At the same time, adding a WakeLock while a basic WifiLock is working may deplete the battery faster and may not fix the issue. What do you think about adding a WakeLock too for this kind of issue and app? private static WifiLock wifiLock = ((WifiManager) appInstance

FIXED: Can't connect to adb over wifi

放肆的年华 提交于 2019-12-01 16:49:35
It turns out that adbd Insecure was, in fact, the problem. When I disabled it (by running the app and unchecking Enable insecure adbd , I was able to connect just fine over wifi. Also, for those who are interested, once this was working then netstat -n did show the connection, i.e.: $ netstat -n Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:5555 0.0.0.0:* LISTEN tcp 0 0 **192.168.0.169:5555** 192.168.0.50:51178 ESTABLISHED tcp6 0 0 ::ffff:127.0.0.1:47514 :::* LISTEN Barry I am unable to get adb to connect over Wifi (it works fine over USB). I've read through the

Connection refused when trying to acces local webservice using Android

感情迁移 提交于 2019-12-01 14:27:58
I am creating a server built in Visual Basic 2010 and that program can insert/update/delete to a database that I use. I created a local Web Service that is used to synchronize the database on the server with the database in Android. I use the following Android code : package com.zelacroix.bukumenu; import java.io.IOException; import java.io.InputStream; import org.apache.http.*; import org.apache.http.client.*; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ConnectTimeoutException; import org.apache.http.params.*; import org.apache.http.impl.client

Cordova - Checking WIFI connection to internet

僤鯓⒐⒋嵵緔 提交于 2019-12-01 13:45:47
I use Cordova to develop a smartphone application. In this app, I need to check the internet connection before send request to a server. In order to do that I use the Cordova Connection API, but in the case that the device is connected to a WIFI network with no Internet connection, this API say that we have WIFI connection, is there any way to check if internet is available on the WIFI network ? Send an Dummy ajax request before you send the actual request, If you get and Error Code as '0' it means there is no internet connectivity. $.ajax({ url: 'TestUrl', type: 'GET', success: function (data

Connection refused when trying to acces local webservice using Android

北战南征 提交于 2019-12-01 13:14:18
问题 I am creating a server built in Visual Basic 2010 and that program can insert/update/delete to a database that I use. I created a local Web Service that is used to synchronize the database on the server with the database in Android. I use the following Android code : package com.zelacroix.bukumenu; import java.io.IOException; import java.io.InputStream; import org.apache.http.*; import org.apache.http.client.*; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn