android-wifi

How to auto connect a WiFi with specified SSID?

末鹿安然 提交于 2019-12-03 07:46:44
Can some body help me to solve this issue? Here is my code, and at mWifi.enableNetwork(netID, true) it's cannot enable network and cannot auto connect to specified network. So I want to know where I had made a mistake? public class WifiConnActivity extends Activity { /** Called when the activity is first created. */ final String tag = "WifiConn:..."; EditText txt; WifiManager mWifi; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mWifi = (WifiManager)getSystemService(Context.WIFI_SERVICE); txt = (EditText

Android Scan for Wifi networks

泪湿孤枕 提交于 2019-12-03 07:20:35
问题 I'm trying to scan for wireless networks and found this helpful source on the net. Unfortunately it's not working and I have no idea why. My problem is that I can't wait 10 minutes for the result - I need them within a few seconds and thought about setting the boolean variable waiting on false as soon as I get a result.... well, it runs forever ... looks like nothing is received. Any idea ? Thanks. // -- Sample WiFi implementation - http://groups.google.com/group/android-developers/browse

Oreo Wifi Connectivity

故事扮演 提交于 2019-12-03 07:16:37
I am working on an IoT app in which there is an on boarding process where the user connects to an access point, which has not internet connectivity, configure the device and then connects to his home Wifi network. Android 8 devices have been causing some problems, disconnecting from the access point and reconnecting to a previously configured network. I am assuming this is related to the connectivity update which was introduced in Android 8, from section Seamless Connectivity in this link : On compatible devices, automatic activation of Wi-Fi when a high quality saved network is nearby. My

Android 6.0.1 couldn't enable wifi hotspot programmatically

▼魔方 西西 提交于 2019-12-03 07:02:12
When I tried to enable wifi tethering from the following code it throws the exception java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com..... .... not granted this permission: android.permission.WRITE_SETTINGS But this works fine in android 6.0 and below versions. And also tried with giving android.permission.WRITE_SETTINGS too. Is there any limitation in accessing wifiAP in android 6.1? Follow I attached the code sample that I used to enable hotspot. WifiConfiguration netConfig = new WifiConfiguration(); netConfig.SSID = ssId; netConfig

Connecting to specific wifi sometimes fails on android

岁酱吖の 提交于 2019-12-03 06:39:26
I am creating an app, which can list out all the available wifi's in a ListView. If I select one of the wifi's in the list, which was cached before in List<WifiConfiguration> list = wifiManager.getConfiguredNetworks(); then it should connect to it. If the WifiConfiguration list doesn't contain the selected wifi, then nothing happens. My problem is, that sometimes I select a wifi from the list (which I know for sure is in the WifiConfiguration list), but it doesn't connects to it. Instead it connects back to the previously connected wifi. After some attempts (selecting again and again the same

Can I have both Wi-Fi and cellular network interfaces open at the same time on Android?

痴心易碎 提交于 2019-12-03 04:53:27
I'm working on an application that will run on a phone where the phone will be a station on a private Wi-Fi network. The phone will be a station, not an access point, and the private Wi-Fi network does not route to the Internet. My application needs to communicate with servers on the Internet as well as devices on the local Wi-Fi network, so it needs to have connections on both networks at the same time. I've been trying to figure out how to do this. I've been trying the technique described in the discussion on the Google Android developers group titled "Can Android 2.X connect to 3G and Wifi

How to Stream Media(Audio/Video) Across Multiple Android device over Wifi or Wifi Hotspot?

倖福魔咒の 提交于 2019-12-03 04:51:27
I am currently working on a project when you play song. it's play in your another device which is automatically play in another android device connected through WiFi or WiFi-mobile hotspot . How to stream audio android device to vlc player. I got Some Help from [Here's a link !] I go through many link bt none of help me. I want build functionality like [ Sound Seeder soundseeder ]. Someone have any solution then please help me. It's mine for me. Thanks..!! For Video Streaming Using Wi-Fi Direct I Found https://github.com/doronz/VirtualFrontView Using Libstremming Library But It's not work on

Send data through wifi (no internet) when mobile data on

梦想的初衷 提交于 2019-12-03 04:35:11
问题 I'm developing and application that connects to a hardware device through wifi (generated by the device) and send data to it through a socket connection. The problem is that when mobile data (3G/4G) is activated android tries to send the data through it instead of sending it through the wifi generated by the device, because because the wifi has no internet connection. I was thinking of using ConnectivityManager#setNetworkPreference() but it has been deprecated in api 21. How can I set it to

Best way to evaluate connection speed

こ雲淡風輕ζ 提交于 2019-12-03 04:08:33
问题 I'm developing an app which needs to get music file by streaming for playing live. In the request song api I can specify the bandwith (eg: 50kbps, 100kbps, 300, 600 or 1 Mbps). The more the bandwith is big, the more the file will get time to be fetched. As I don't want the users to be restricted about that I have multiple choices to deal with it: Detect wether the phone is using 3g, wifi or Edge and specify an bandwith for each connection speed. Let the user decide the quality of the song he

how to obtain the ip address of the connected wifi router in android programmatically?

会有一股神秘感。 提交于 2019-12-03 03:56:00
I want to obtain the ip address of the the wifi router to which my android phone is connected? I know that we can get the mac/BSSId and SSID by using the android APIS but I don't find the way to find the way to find the ip address of it? I found the code for obtaining the ip address of phone owns wifi router WifiManager myWifiManager = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo myWifiInfo = myWifiManager.getConnectionInfo(); int ipAddress = myWifiInfo.getIpAddress(); System.out.println("WiFi address is " + android.text.format.Formatter.formatIpAddress(ipAddress)) but failed to get