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!
Related
I'm trying to debug Flutter apps with ADB over TCP, so tried the following (Android connected with USB) according to this:
adb tcpip 5555
adb connect <Android-ip-address>:5555
But I always get unable to connect to <Android-ip-address>:5555: No route to host.
I installed the plugin Android WiFi ADB to Android Studio, but...no hope.
After that, I tried to ping my Android phone from PC with that command ping <Android-ip-address>, but again it failed with that output From <PC-ip-address> icmp_seq=1 Destination Host Unreachable.
Now I tried to do the same thing (PC & phone), however on an another router (Tenda) and it worked like a charm.
So the problem is from my router, which is a D-Link with a firmware version ME_1.03. I searched for "Port Forwarding" and stuff like that, but I don't know what I'm doing and I didn't come up with any result.
What can I do to solve it.
It's not about router type (in case it doesn't use something different from TCP/IP, Lol). You need to double check, that both devices inside one local network.
Without any additional settings on router, your IP address could be like this xxx.xxx.xxx.***. Where part with xxx should be same both both device. When this is done, follow instruction from the source. Please note, you will need to connect devices with USB, before using TCP.
The firmware can be found here below DSL > 2750U, while there are 2-3 different hardware revisions, therefore it is rather unclear which device it actually is - for some revisions there is newer firmware. Generally, the router's network bridge in between wired LAN and WiFi needs to be enabled, in order to connect. Just see the router's manual on page 33 and 45. Without that bridge, you could only connect adb from a notebook, through the same wireless network segment, as the smartphone is connected to (unless "User Isolation" is enabled on the router).
Finally I found it. It's because of a feature (as others said) called WIFI/User Isolation in routers. But in my case, it's called Relay Blocking. Anyway, you have to disable it.
In D-Link (DSL-2740U) - Firmware Version ME_1.03:
Main Page ---> Advanced ---> Advanced Wireless Settings ---> Relay Blocking.
Check disabled choice.
I'm keeping my Samsung tablet always connected to a 360 camera (Ricoh Theta S with OSC API), trying to send 360 images to a custom server autonomously over 3G thanks to a homemade Android app, with no human supervision.
OSC specifications mention that the camera acts as a Wifi access point and devices connect to its ESSID on a local 192.168.0.* network to take pictures. After capturing the picture, Android prioritizes the Wifi in order to reach the server, and asks the camera's DNS to resolve example.com, which inevitably fails.
I must manually disconnect the Wifi interface from the camera to let Android establish the 3G connection and in the end send the iamges on example.com, which requires a manual operation that I don't want.
Problem is that Android's routing behaviour looks binary: 100% Wifi or 100% 3G. While I feel that I need a custom routing table, that would be somehting like :
192.168.0.* over Wifi
*.*.*.* over 3G
Samsung tablets have an Intelligent network features that can proactively switch between 3G and Wifi when connection is weak, but that does not fix the problem because I assume they make decisions according to the quality of the physical connection. So it does not switch to 3G even if example.com fails to resolve.
What's the next solution to make this autonomous? Disabling and enabling Wifi from the code does not ensure Android will reconnect to the right camera's ESSID afterwards, plus the camera goes to standby after a few minutes of Wifi disconnection.
Does rooting the tablet to modify the way Android prioritizes Wifi or 3G look feasible?
First of all, let me answer your last question.
Yes, rooting should solve you problem. Any it's the only possible way to use Wi-Fi and cellular networks simultaneously.
To enable simultaneous connections on rooted device, execute:
pkill dhcpcd
svc wifi disable
svc data enable
netcfg wlan0 up
cd /data/misc/wifi/.
wpa_supplicant -B -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
dhcpcd wlan0
and define desired routes:
ip route add x.x.x.x via x.x.x.y
sometimes I have to connect my Nexus 5 to a WiFi network only to share some files with other devices, but this network does not have Internet access. I would like to use 3G for data connection while the phone is connected. Obviously I have root access. Is there any way to achieve this? (Not necessary a simple way)
My phone isn't rooted and I don't have a shell installed on it to test, but off the top of my head maybe this could help?
route -n - determine what routes are available
route add default gw <<ip address>> - replace with the gateway's IP address that you want to be the default. Make sure to run this command as root or with sudo.
I'm not familiar with Android shell access or the internals of how Android manages its networking. For all I know, the entire 3G Internet connection may shut down by default when you are on wifi. If all else fails, you could also consider a "mobile hotspot" app for your phone, and have the devices connect to you (as a bonus, they would have Internet access too).
More information on viewing default gateway with route command
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.
Is it possible to have both 3G and Wifi connections up and running? I want to transmit at the same time through both interfaces.
However, I've noticed that when Wifi is up, 3G is going down. Actually, it seems that the routing table is updated on on/off of the interfaces.
Route table UMTS on / Wifi on
a.b.c.1 dev rmnet0
a.b.c.0/24 dev rmnet0 src a.b.c.2
default via a.b.c.1 dev rmnet0
Route table Wifi on / UMTS on
192.168.1.0/24 dev eth0 src 192.168.1.147
default via 192.168.1.1 dev eth0
With wifi on I have run:
ip link set rmnet0 up
ip route
192.168.1.0/24 dev eth0 src 192.168.1.147
a.b.c.0/24 dev rmnet0 src a.b.c.2
default via 192.168.1.1 dev eth0
When I saw that I thought that I have managed to put both devices up and running. However, this is not the case. When I ping a public internet address (a.b.c.3), in case 1) and 2) everything goes well. In case 3) I get no answer.
Where on earth does Android set that only one device can be available at a time? How can I make both interfaces to be up and available, like on an ordinary Linux box?
P.S.: I have tried the solution in [1] to enable the data connection when wifi is on, and no way.
[1] How to enable data connection on Android 2.3
[2] How to block calls in android --> using ITelephony to get the telephonyService.enableDataConnectivity(); but I get an exception.
This is not going to be possible... unless you are will to go to great lengths to make it work. You are essentially asking for you device to become a router.
To do this you will need to find a program (sorry can't remember any names at the moment) that will accomplish this on a normal linux distro. Then recompile it to fit the Android OS and install is into the native system.
This explanation may make a little more sense to you. If you go to your ADB shell and run netcfg (or ifconfig to verbose this) you will see the devices networking options. You can run an ifconfig command to set the device or change its state - but you cannot have multiple devices route data to and from the phone at the same time I wouldn't think.
This would be my best guess...