android-wifi

How to find wifi and network data usage separately by particular application in android?

雨燕双飞 提交于 2019-12-03 03:14:14
recived = TrafficStats.getUidRxBytes(uid); send = TrafficStats.getUidTxBytes(uid); TrafficStats.getMobileRxBytes(); TrafficStats.getMobileTxBytes(); TrafficStats.getTotalRxBytes(); TrafficStats.getTotalTxBytes(); i have application id and i can get that application data usage but i cant get information in more detailed like data usage using wifi and network. i want to find both separately for all installed application in device. how can i find that.? i have already tried many things but didn't get any solution for that. artemiygrn I think you should use alternative way, get traffic by UID, for

Multicast Support on Android in Hotspot/Tethering mode

廉价感情. 提交于 2019-12-03 02:07:29
I have a prototype Android app that is listening for multicast packets to 'discover' clients to communicate with. The socket set up is similar to this: InetAddress group = InetAddress.getByName("228.1.2.3"); MulticastSocket s = new MulticastSocket(4000); s.joinGroup(group); This works very well when all the devices are connected via WiFi. I would like to support this with the phone acting as a portable hotspot. However, while all my devices appear to connect to the hotspot correctly I no longer receive multicast data. I'm wondering if there are restrictions that disallow this type of

Connect android to two wireless networks simultaneously

廉价感情. 提交于 2019-12-02 23:59:04
I want to make my android connects two networks at the same time, the first one a wifi network to get internet connection and the other one ad-hoc network ( a network between mobiles to share some data), but the android can join only one network at the same time, Any ideas!! What you are asking for can not currently be done. You can only be connected to one network at the time. However, there is a standard called WiFi direct that will allow you to do what you are asking for, but it isn't yet implemented in Android. I recently talked with an Android engineer at Google about this, and they are

Jelly Bean Issue - wifiManager.getConnectionInfo().getSSID() - extra “”

有些话、适合烂在心里 提交于 2019-12-02 22:06:32
Hi all bug reporting for your information. link Problem details : The Code - wifiManager.getConnectionInfo().getSSID() The above code to returns the current SSID, it is returning the current SSID with extra quotations around it. For eg. the SSID internet is returned as "internet" . This is only seen on Jelly bean 4.2 using device Nexus 7. This bug is causing errors in our app as we compare the current SSID with the SSID that we are trying to connect too. The code wifiManager.getScanResults(); however still returns all SSID's without extra quotation marks. this is not a bug and behavior is

Creating WPA2 PSK Access Point in Android Programmatically

拜拜、爱过 提交于 2019-12-02 21:30:05
I want to create Access Point in android programmatically with the following configurations. AccessPointName :SomeName Security:WPA2 PSK Password:SomeKey How can i do that? Regards I had faced this problem once. In order to create a WPA2 PSK access point, you need to populate the WifiConfiguartion object with your WPA2 PSK parameters. However I could not find a way to set KeyManagement as WPA2_PSK . There was only options for WPA_PSK , IEEE8021X , WPA_EAP and NONE . Then I read the android source code for WifiConfiguration.java . I was able to find out that indeed there is option for WPA2_PSK

How can i check my android device support wifi direct?

无人久伴 提交于 2019-12-02 21:29:04
I am working with android wifi direct demo application. After installation in my device I noticed that it is not working as expected. I am confused, does my device support wifi direct or special hardware feature required for wifi direct? My device is local walton brand and API level 16. After reading android documentation i know that Wi-Fi Direct added in API level 14 doesn't need a wireless access point. My other question is if in a place where no wifi zone is created using wifi direct two or more device communicate with each other. in summing my problem, i need to know if my device not

Get Android WiFi “net.hostname” from code

≯℡__Kan透↙ 提交于 2019-12-02 21:15:28
When an Android device connects to a wifi AP, it identifies itself with a name like: android_cc1dec12345e6054 How can that string be obtained from within an Android app? Not for the purpose of changing it, just for readout. EDIT: This is a screenshot of my router's web interface, showing a list of all connected devices. Note the two Android devices on the list -- How can that string be read from Java code running on the device? Building off of @Merlevede's answer, here's a quick and dirty way to get the property. It's a private API, so it's subject to change, but this code hasn't been modified

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

感情迁移 提交于 2019-12-02 18:53:34
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 send data using the wifi generated by the device instead of the mobile data interface? hygorxaraujo

Peer to peer data sharing using Wi-Fi direct

不羁的心 提交于 2019-12-02 18:15:22
问题 I am developing an Android multiplayer game using Wi-Fi direct . Using Wi-Fi direct, I am able to establish connection between peer devices. Also the code is able to send the data from client device to server device. (According to Android documentation, the Wi-Fi direct uses client-server model) Problem : I am not able to share the data from server device to client device using Wi-Fi direct. I have following questions: Is there any other way to transfer data (bi-directional) between two

Best way to evaluate connection speed

风流意气都作罢 提交于 2019-12-02 17:28:06
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 will get: like youtube (but the users won't be people that know much about computing: the more easy is