wifi

Android 6.0 Cannot add WifiConfiguration if there is already another WifiConfiguration for that SSID

谁说我不能喝 提交于 2019-12-04 00:40:24
问题 Android 6.0 made some changes to the WiFi behavior and it breaks my app behavior and cannot find a solution for it. Basically, for Android 6.0 you are not permitted to modify or delete WifiConfiguration objects that are not created by your app. This means I need to always create my own WifiConfiguration objects. However, if there is already a WifiConfiguration for a particular AP made by the user or other app, I cannot create another one for that AP. wifiManager.addNetwork(wifiConfiguration)

android -------- WIFI 详解

风流意气都作罢 提交于 2019-12-03 23:45:53
今天简单的来聊一下安卓开发中的Wifi,一些常用的基础,主要分为两部分: 1:WiFi的信息 2:WiFi的搜索和连接 现在app大多都需要从网络上获得数据。所以访问网络是在所难免。但是在访问网络之前,我们应该先做一下网络的状态判断。其实在访问网络之前我们要做一些状态判断,对应一些状态判断来做处理,并不是直接使用Http访问网络即可。 很多人在开发就经常把网络这块直接跳过,直接访问网络,一旦断网,各种体验效果不好,不是说app没法用,只是体验效果差。还有,就是我们可能为用户考虑,因为现在一般连网是wifi和手机流量,都知道后者收费是比较高的。假如我们的app加载的图片或者有大的数据下载操作,可是用户的本意是要是在流量下的话就不要操作这些很费流量的的操作,这样就必须要我们做一些连网状态的判断。网络是否连接良好,连接的wifi还是流量,断网或者网络改变了的时候怎么做,这都是一些细节,但是要注意处理。 WIFI开发的三个类和功能描述: 类名 功能 WifiManager wifi统一管理类,进行各种wifi操作 WifiInfo 描述当前连接的wifi热点信息 WifiConfiguration wifi网络配置信息 WiFI的信息 获取连接WIFI的信息 WifiManager mWifiManager=(WifiManager) this.getSystemService

Android … how to find out if I'm on a wifi internet?

耗尽温柔 提交于 2019-12-03 22:59:38
问题 In my application I just need to know if the device is connected to wifi network or not. I think this function works on emulator but not on real device. public static boolean wifiInternet(Context c) { try { ConnectivityManager connectivityManager = (ConnectivityManager)c.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = connectivityManager.getActiveNetworkInfo(); // CRASHES HERE String name = ni.getTypeName(); if(name.equals("WIFI")) return true; else return false; } catch

Sending data to ESP8266 Wi-Fi chip from Android device

我是研究僧i 提交于 2019-12-03 22:58:11
I have a ESP8266 chip which is connected to the microcircuit. When chip gets value "200" the light is starting to blink 4 times and than it returns "100" value. I need to make an Android app using Java which will connect to the ESP8266 chip, send data to it and will get value "100". I don't know what library I should use to deal with it. Please, help me, how can I do that? I think it is not the most hard question here. For your Controller you dont need any Libary. You just can use the serial AT Commands: http://www.electrodragon.com/w/ESP8266 After setting up your ESP like this: In your App

Can WIFI be turned off programmatically

浪尽此生 提交于 2019-12-03 22:28:42
问题 How can wifi be turned off/on programmatically and do is rooted or system app required for this. 回答1: Permissions are required. I just wrote this app that toggles Wifi. Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.stackoverflow.q5766518" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="3" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses

iOS6.1: Problems while trying to access WiFi RSSI (MobileWiFi.framework)

杀马特。学长 韩版系。学妹 提交于 2019-12-03 20:43:55
I'm trying to access the RSSI values of several APs around me using an iPod Touch 4G with iOS6.1 and Xcode 4.6.3 with a valid Provisioning Profile. I've read some discussions about this topic and the best way to do this seems to be using the private Framework MobileWifi. Since this project is for private usage only I'm ok with that. According to this website I need a special entitlement in order to access the MobileWiFi functions. I've never worked with entitlements before, but according to some examples my .entitlement file looks like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE

is p2p0 a wireless interface for WIFI DIRECT in android?

一曲冷凌霜 提交于 2019-12-03 20:20:06
when i print all interfaces in my android device: 03-10 19:50:15.484: I/System.out(22415): lo 03-10 19:50:15.494: I/System.out(22415): upnlink0 03-10 19:50:15.504: I/System.out(22415): svnet0 03-10 19:50:15.504: I/System.out(22415): rmnet0 03-10 19:50:15.514: I/System.out(22415): rmnet1 03-10 19:50:15.524: I/System.out(22415): rmnet2 03-10 19:50:15.534: I/System.out(22415): sit0 03-10 19:50:15.544: I/System.out(22415): ip6tnl0 03-10 19:50:15.554: I/System.out(22415): p2p0 03-10 19:50:15.564: I/System.out(22415): wlan0 i wounder if p2p0 is the actual interface for WIFI DIRECT? also how to print

Android, detect local IP and subnet mask for WiFi, both while tethering and connected to access point

倾然丶 夕夏残阳落幕 提交于 2019-12-03 20:16:18
I need to detect the local IP address and subnet mask on the WiFi network, on an Android device (in order to proper calculate the UDP broadcast address strictly for the local subnet). When the device is connected to an Access Point, the following is properly working: // Only works when NOT tethering WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); DhcpInfo dhcp = wifi.getDhcpInfo(); if (dhcp == null) throw new IOException("No DHCPInfo on WiFi side."); foo(dhcp.ipAddress, dhcp.netmask); But it doesn't work when it's the android device providing an Access Point

Start Androids WiFi-Manager by sending an intent?

给你一囗甜甜゛ 提交于 2019-12-03 20:06:26
I´m developing an application, where I´d like to have a button, which opens Androids built-in WiFi menu... (I don´t really want to implement scanning and connecting code by myself). Is there any Intent I can send which opens this menu? You should use ACTION_PICK_WIFI_NETWORK action: startActivity(new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK)); Also, if you want to implement it yourself (so it looks like your app), the Android SDK offers the WifiManager -class, which should do most of the work for you. If you want to open the default Wifi settings dialog, you can use an intent with an ACTION

Programmatically connect to an android device in Portable hotspot

一个人想着一个人 提交于 2019-12-03 19:09:07
问题 I have succesfully created a portable hotspot programmatically on my device with a specified SSID. Now I want to connect to it from another device! I'm using this code: WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" + "TinyBox" + "\""; conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); wifiManager.addNetwork(conf); List<WifiConfiguration> list = wifiManager