I was testing WiFi Direct on my Android Devices. I have a Galaxy Note running 4.0.4, and a Nexus 7 running 4.2.1. I followed exactly from the official API on WiFiDirect.
After the devices found each other, if I try to make them "connect", I'll be able to see an invitation of WifiDirect connection, but after I "accept" this invitation, the status of this device changed to "invited", while on the other device (which sent the invitation initially) got no response. Thus a wifi-direct connection can never be made among the two device.
I then tried the official Wifi-Direct Demo program... but it doesn't seems to work also.
After I rooted my Galaxy Note and upgraded it to 4.1.2, this problem disappeared.
But I wonder if anyone encounter same problem as I did? And if so how did you solved it?
Thanks a lot.
To find the exact reason you have to look at the log report of wpa_supplicant(this can be seen from the log report using android debug bridge(adb) available in adt bundle with eclipse # http://developer.android.com/sdk/index.html ).
I have faced a similiar problem while trying to connect androd 4.0 tablet with ubuntu laptop.The problem was with the dhcp server which was supposed to assign an IP address after the Group negotiation is successful but it wasn't respondig may be due to difference in the versions or some other reason.This wasn't a bug with wifi direct.
I fixed it by assigning a static IP address to the p2p_wlan0 interface on both the devices.
Related
When browsing the internet using the Wi-Fi hotspot of my Android phone (Xiaomi Redmi Note 10 Pro), some requests fail with the following error: net::ERR_SSL_PROTOCOL_ERROR
Here is a screenshot of the error I'm getting in Chrome for Mac OS:
I noticed that it is happening only on specific websites (I have no issues on Stack Overflow for example).
This seems to be happening regardless of the LTE network quality.
I tried using the Wi-Fi hotspot from another phone, and everything is working as intended.
Anybody have an idea on how to debug this issue?
Thank you
I fixed the issue, turns out the default APN was not correctly configured.
I re-configured my APN with the config given by my phone provider (for Orange in France, the config is here: https://assistance.orange.fr/mobile-tablette/tous-les-mobiles-et-tablettes/installer-et-utiliser/se-connecter-et-parametrer-un-reseau/se-connecter-a-un-reseau-mobile-3-4g/comment-ajouter-un-point-d-acces-internet-apn-sur-votre-mobile-xiaomi-sous-android-_321636-856633)
I wanna use a library from GitHub named "Android Network Tools", but actually I have a complex issue when using that. I tested the ping of this library on different type of devices and Android versions, and it worked correctly and was perfect, but when I tested it on my Samsung Galaxy S8 with android 8 I saw pinging external IP(like google.com) didn't work! at the first, I thought it happens in Android 8 and tried to solve it, but I launched it in Android 8 with the emulator that was ok! after that, I decided to test it on my friend's Samsung J7, you can guess that what happened, it didn't work again!
Right now, I'm really really confused because of I don't know why it happens just on Samsung devices, do you have any idea?
The problem is not with your code , the problem is occurring because of Device manufacturers They change the Os according to there need which causes issue with ping , see
Why does ping works on some devices and not others?
Finally, I found the problem, this was about control running apps in the background! when that feature be enabled some methods and ping doesn't work correctly in real-time.
power saving mode
Yes this is correct. With any power saving mode active, on at least some Android o/s versions, ping will not function. I'm guessing icmp echo reply packets are dropped. A sniffer app would confirm this. It is possible icmp echo (outbound) packets aren't even generated. Crazy in my view. Most ping utilities are very lightweight and I would have thought consume minimal power. I'm running a Samsung J5 / Android v.7.0. Ping started working once I disabled power saving mode
I was trying to run androidx86-ieee.iso on VM and everything works fine. The VMs (Android) can connect to the internet via bridge mode successfuly, share Bluetooth via my dongle on Windows 7 host (since no error is thrown while activating Bluetooh). But the devices cannot detect each other (or my phone for that matter).
I recall in the previous VMWare version (v7) when there was no support to share Bluetooth device, I could connect to my phone when only 1 of the VM had control over it (Sharing Bluetooth was not permitted). But I required Bluetooth sharing.
My netcfg shows 192.168.1.x address for both devices since they are connected to the internet, but cannot see each other on bluetooth.
Any help is greatly appreciated.
Answering my own question. I googled aplenty and found out the 2.3 Gingerbread android x86 iso I was using is buggy as confirmed by a user here Android-x86 Google Group and had requested him for the ISO he compiled after fixing the Android 2.3 code, which he rightfully obliged.
For anyone viewing this or having the same problem, the fixed ISO is uploaded here.
I am trying to develop an wifi peer to peer application in android(4.+).
The problem here is how to test it.
I tried to run that application in android emulator. there was no option to configure wifi in the settings menu, i also tired to enable wifi using the dev tools application form the emulator but it didn't work, And through all my googling over 3 days and i found that Android emulator is not supported the Wifi.
So i opted for androidx86 4.0eeepc using virtual box and tired to add devices both wifi and bluetooth (my app uses both bluetooth and wifi) but only bluetooth device got added and it did not work. But my virtual box detected the wifi and bluetooth devices. I just couldnt get them work with the virtual machine.
I tried everything like manually adding the addresses using terminal emulator app in androidx86 and used netcfg through the android commandline but neither of them worked.
Please suggest and guide me on the correct path to run these kind of applications that use wifi and bluetooth in android.
Thanks in advance.
First, be sure you enabled WiFi Direct in the Android settings for the two virtualbox instances:
Settings --> Wireless & Networks --> More... --> Wi-Fi direct
It has been stated as working once that hurdle was overcome, and I'm sure many have experienced the same...just be sure to enable wifi direct
I would have tried exactly what you've already tried by naturally moving from the emulator to the androidx86 project. Although unreliable, I'd recommend looking at and finagling this, if you haven't yet seen it: Android: Simulate WiFi in the emulator? and How to disable/enable network, switch to Wifi in Android emulator? most likely wouldn't have full out success but may be enough to let you know that it works or would work.
As far as testing WiFi-Direct/WiFiP2P without you yourself having a device/s, I would recommend:
Trying out some of the fiddling as mentioned above. And read through tons of logs.
You could always crowd source it to friends, or release an apk on a forum for a small group of testers.
Of course, both of those options are not ideal, seamless, or fast. So, I'd definitely hope you get VirtualBox VMs of AndroidX86 4.0 running as it should once you check that setting and pair up the WiFi APs :-)
A near future solution:
This might be something to look into in near future.
Real devices are hosted by Samsung and screens are streamed to your PC.
http://developer.samsung.com/remoteTestLab.do
According to an email responded by samsung, which I sent to them earlier.
They only have 2 devices (Galaxy Nexus) running on Android v4.0 at the moment.
Unfortunately they are not physically close to each other. (One in Korea, One in Poland)
But they are planning to upgrade existing Galaxy S2 to v4.0.
Because recently Samsung have released v4.0 upgrade for S2.
Once they done that, there will be plenty of v4.0 phones.
And you can ask them which 2 phones are physically close so you can test Wifi Direct.
--------------------------- EDIT ---------------------------------
There are plenty of ICS devices there now, which you can test P2P.
Check with them which 2 are physically near to each other.
Per the docs:
Each instance of the emulator runs behind a virtual router/firewall
service that isolates it from your development machine's network
interfaces and settings and from the internet.
You have to use Network Redirection, as described in the Developer Docs. In essence, you forward specific ports using ADB. Therefore you cannot test certain things like broadcast messages.
I have tried doing what you are trying to do, and-- while I won't say it is impossible (anything is possible in computing with enough time, money, and persistence)-- I wasted a lot of time on it. You cannot treat the Android emulator as a normal network peer-to-peer device. As far as I have been able to find, it is a fork of QEMU, and that is just how the QEMU emulator is implemented.
QEMU itself does support TUN/TAP bridging, but I was never able to get it working with the Android emulator. If you want to go that route, you may want to investigate running Android in the QEMU emulator, rather than in the SDK's emulator (I see you are already trying a similar approach with VirtualBox).
Unfortunately the best way to test a peer-to-peer networking program in Android is with physical devices at this time-- unless your app can suffice with the port forwarding method.
See Also: Issue 26:Emulated Androids should be able to communicate via TCP, and Google
(Repeating here my answer elsewhere.)
In theory, linux (the kernel underlying android) has mac80211_hwsim driver, which simulates WiFi. It can be used to set up several WiFi devices (an acces point, and another WiFi device, and so on), which would make up a WiFi network.
It's useful for testing WiFi programs under linux. Possibly, even under user-mode linux or other isolated virtual "boxes" with linux.
In theory, this driver could be used for tests in the android systems where you don't have a real WiFi device (or don't want to use it), and also in some kind of android emulators. Perhaps, one can manage to use this driver in android-x86, or--for testing--in android-x86 run in VirtualBox.
I'm seeing a weird issue with setting up a wifi proxy in Motorola Razr with android version 2.3.6. I'm able to set the wifi proxy properly. I've tested it by running browser from phone and seeing data passing by the proxy debugging tool (charles). But when I fire up the app, requests doesn't flow thru charles anymore.
Do you have any idea, why apps behave differently than browser?
Thanks.
Simple. Every app developer should use the proxy if it's set. But sometimes they don't.