Is it possible to write an app in Android using the wifi API which will act like a hotspot (so granting network access to wifi clients) while still allowing the local wifi device to connect to another wifi network ?
The one I've tested are disabling local Wifi connection in order to create a hotspot.
I post here after a few months so people that would like to implement this on an Android device might be helped.
There is a way to have one wireless chip working in hybrid mode, with both station mode (STA) and access point mode (AP) enabled.
To do this, I replaced the wireless driver of my chip with a multi-role wireless driver. Luckily enough, my chip was supporting this mode, it is however not the case for every wireless chips. My chip being a TI based chip (wl1271), multi role was supported, though it was not available with the previous driver.
Once I got this new driver, I had to recompile it along with my kernel in order to have the .ko of the wireless driver and the related mac80211 and cfg80211 modules (providing the APIs needed by the new driver) generated. The last step was to upgrade wpa_supplicant and hostapd with a custom patched version provided by TI.
Again, for people interested in wl1271 only here are the corresponding drivers/tools I used and reported working on Android 4.0.4 ICS :
https://github.com/TI-OpenLink/hostap/tree/ol_R5.SP3.01
https://github.com/TI-OpenLink/iw/tree/ol_R5.SP3.01
https://github.com/TI-OpenLink/ti-utils/tree/ol_R5.SP3.01
https://github.com/TI-OpenLink/wl12xx_target_scripts/tree/ol_R5.SP3.01/sta
https://github.com/TI-OpenLink/compat/tree/ol_R5.SP3.01/
https://github.com/TI-OpenLink/compat-wireless/tree/ol_R5.SP3.01/
If there is a multi role driver for your wireless chip, it might be worth it finding out what version or patches of wpa_supplicant and hostapd you shall use, and compile/try them.
At the end of the process, I had access to two network interfaces (wlan0 and wlan1), and could launch wpa_supplicant on wlan0 and hostapd on wlan1.
What you are describing is called WDS (Wireless Distribution System). I think that this functionality is not implemented in Android wifi API. It is used in wireless APs to enable a wireless link upstream.
Related
To support this features , are there any changes require in hardware or firmware?
Wifi easy connect (DPP-Device Provisioning Protocol) and Enhanced Open (OWE) need wifi vendor's support. It might not be implemented in wifi HW, but in the wifi driver with/without FW patch, depends on wifi vendor design.
Most relative functions are implemented in wpa_supplicant, which is the application in user space. And the wifi driver needs to report the data, received from AP to wpa_supplicant, and transmit the correct data generated from wpa_supplicant to AP, by using kernel cfg80211 functions.
wifi easy connect
need to handle public action frame
OWE (Opportunistic Wireless Encryption OWE)
PMK is generated by association handshaking.
so the wifi driver needs to use e.g. cfg80211_connect_result() to report association response ie to the wpa_supplicant
i'm working on a wireless ad hoc network, at the moment i still designing my network.
The network should work for android devices.
Until now i thought to use a phone as a hotspot, so nearby devices could connect each other, but what if two hotspots have to speak to each others?
Basically the question is: Can two or more hotspots connect and communicate each other?
Thank you.
Yes, you need to use WiFi Direct for this. When using WiFi direct in concurrent mode, and device can act as both a client and an AP the same time. This is what you need. Whether it will work for you as is, depends on your specific device and driver, but there is support for WiFi Direct in Android since v4.0. Sometimes WiFi Direct is also called WiFi Peer-To-Peer or WiFi P2P and this is what the Android API calls it.
see Android WiFi P2P
With the Android API you can discover other peers and services you define and connect to them.
The WiFi p2p utilities are under very active development, so I am not sure if the Android is currently supporting the concurrent mode. You can try. However, you can also setup your connections directly by using the wpa_supplicant utility which is actually what Android is using internally. I have been able to use this directly from my applications for other purposes. If the version that Android is using is not working, or if you find it a bit unstable, you can get the latest version from the hostap and wpa_supplicant projects. Installing those may require root access though.
I'm developing a platform using ODROID U3 with Android for a custom application. I merged the MPTCP Kernel Source with Android Kernel Source to get a MPTCP Enabled Kernel for Android.
The only thing is that Android by default disables the 3G Connection when a Wireless is available, and I want it to be both available to MPTCP work by share-loading it.
I can manually manage all stuff, but I didnt find what disables the 3G Connection and how to bypass it. I also have BSP if needed to bypass it.
Anyone knows where I can bypass or where it does the 3G Disconnection?
PS: I already saw Android High Priority Connection, and this doesnt apply to me. I need both connections working for I make the MPTCP routes transparently for the Network Access. Also I'm aware that this is not something I can do in non-rooted devices. I have root, and I can also recompile entire Android System from the BSPs. I searched all over the internet and I didnt find anything about that (only the High Priority Connection)
What I already have tryed:
1 - High Priority Connection: Works fine, but the application needs to be open. And I want the MPTCP system-aware not application-aware.
2 - Turn on Wifi, connect. And them manually bring up the Mobile Connection Interface via terminal: Doesn't work. For some reason the Mobile Connection doesn't get IP from DHCP.
3 - Search on Android BSP anything and anywhere it could switch off/on the Mobile Connection: Didn't find anything specific.
Thanks!
I found the solution here: https://sites.google.com/site/lotuseaterarpit/news/3g4gwififorandroidconcurrently
So basicly you need to disable wifi service from android (using svc wifi disable and them manually configure the Wireless Network as so:
Lets supose we have the wireless internet at wlan0, we will do:
Disable the Wifi Interface Service
svc wifi disable
Bring up Wifi Interface
busybox ifconfig wlan0 up
Configure wlan interface
iwconfig wlan0 mode managed essid YOUR_SSID
iwconfig wlan0 key s:WIRELESS_KEY
iwconfig wlan0 commit
DHCP interface to get IP
dhcpcd eth0
So with this, you can have your 3G Connection online together with Wireless Network. You need to configure the routes by yourself, but this will make you able to do that.
Hope it helps!
I am trying out one example with of wifi-Direct for android.
I have run the the demo application on two different android phones.
Is it that both the application needs active wifi AP?
Is it necessary that we need to connect both the device to same wifi AP?
Is it that disabling wifi on the device will disconnect the wifi-direct session?
Can some one point me to one simple (basic) example of wifi-direct.
Android setting app can search and connect via wifi direct
4.0
setting app -> wireless setting other -> wi-fi direct (checked)
https://android.googlesource.com/platform/packages/apps/Settings/+/android-4.0.1_r1.1/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
if this activity didn't shows on your device, try create shortcut app, such as
https://play.google.com/store/apps/details?id=com.sika524.android.quickshortcut
currently disabled p2psettings activity on AOSP source code.
so i'm strongly recommended 4.1 later device.
4.1 later
setting app -> wireless setting -> (menu) -> wi-fi direct
my test app shows how to use wifi direct api.
https://github.com/kensuke/WiFiDirectTestApp
According to Android docs:
Wi-Fi peer-to-peer (P2P) allows Android 4.0 (API level 14) or later
devices with the appropriate hardware to connect directly to each
other via Wi-Fi without an intermediate access point (Android's Wi-Fi
P2P framework complies with the Wi-Fi Alliance's Wi-Fi Directâ„¢
certification program).
So, you don't need to connect to any access point. just enable wifi and start to search available devices to connect.
disable wifi will disconnect wifi direct connection.
here is my app shows wifi direct connection and transfer files.
https://github.com/Youxian-Chen/WiFiDirectTransfer
hope this helps.
I a trying to connect my Nexus One with Android version 2.2.1 with my pc and use a terminal program such as windows terminal or hyper terminal to communicate. To do this I believe I need to set up an outgoing serial com port. I have paired the devices. When I go on my PC to Bluetooth -> settings -> "add com port" the android device does not display.
What am I missing?
Does android 2.2.1 support spp? The documentation says it does.
Do I need to root the android to add spp?
Has anyone succeeded in this?
My final goal is to write an android app that communicates with an old school bluetooth device that requires com ports? Getting the android to communicate with the pc is an interim step.
I have tried everything I can think of in my android app to connect to my pc and android device but have not been successful. My android app is essentially the same as Serial over Bluetooth submitted by xCaffeniated but with fewer comments. Any suggestions?
Try beginning with the BluetoothChat sample application. You will then have to alter the UUID used to the generic SPP UUID,
00001101-0000-1000-8000-00805F9B34FB
From this point you pretty much have everything you need.
I have had issues pairing in the BluetoothChat program. So I was required to pair to my computer using the settings menu and then entering the BluetoothChat Program. In BTChat go to the menu and hit connect to a device, choose your computer. I can only speak for windows XP SP3 which is what I'm using. At this point on my machine I receive a task bar pop up asking me if I would like to allow my device to connect as a serial port. I allow it to. Now your phone is associated as the serial port profile on the computer, which you can associate with a specific com port.
Based on bluetooth spec,
http://www.bluetooth.com/SiteCollectionDocuments/SPP_SPEC_V12.pdf,
2.3 User Requirement, "... Any legacy application may be run on either device, using the virtual serial port as if there were a real serial cable connecting the two devices (with RS232 control signalling)." In 4.3 Remote Port Negotiation, "...There is a requirement to do so if the API to the RFCOMM adaptation layer exposes to those settings (e.g. baud rate, parity)... RFCOMM as such will not artificially limit the throughput based on baud rate settings,..."
In my opinion, since Android (2.2) offers no APIs to set up and open a serial port, they may not be necessary as long as you can discover the remote BT device and make a connection to it. I have tried it and it seems working with:
...
sock = device.createRfcommSocketToServiceRecord(myUUID);
sock.connect();
...
where final UUID myUUID= UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); You may need to take care of Bluetooth Permission and Setup in your application as described in
http://developer.android.com/guide/topics/wireless/bluetooth.html
There might be some issues with the connect() call, i.e. Service is not available or connect is refused, which could be resolved by making sure:
The remote BT device be discovered, and
It must be set to use PIN code (for instance 0000), and
It must be paired successfully with your Android device
These steps must be completed prior to running your application (which has connect call).
Hope this help.
George
There is definitely some funny business regarding how the AT set is implemented on the AOS. The problem is that it is hard to know if you're actually talking directly to Modem or through several abstraction layers (more likely). For a best up-to-date review of the AT Commands available on the AOS platform, plus HW, please see the post:
"How to talk to the Modem with AT commands"
http://forum.xda-developers.com/showthread.php?t=1471241