How to send icmpv6 Router Advertisement messages from an Android device - android

Some time ago I implemented a radvd daemon in a linux device in order to send icmpv6 Router Advertisement messages to its tethered devices.
I took the radvd version 1.9.2 from this site: http://www.litech.org/radvd/. I compiled and installed it and wrote a small module to manage it (launch radvd daemon, define radvd configuration file according to device settings, etc.)
I am looking for doing the same in an Android device with Nougat version. I assume that the device properly received an IPv6 address from the system.
So far I founded radvd version 1.8.5 for Android in this site: https://github.com/ddrown/android_external_radvd.
Is it a good version to start with in Android or does someone know a better option?

I enabled bluetooth tethering on one Android Phone and connected Another Android Phone using Bluetooth. I could observe that the tether enabled Android phone was capable of sending router advertisement. The Phone on which i enabled bluetooth tethering was connected to a mobile network that gave it an IPv6 address. So I dont think there is any need of a seperate radvd but I am not sure yet on which module on Android is helping to send router advertisement probably dnsmasq*
Above exercise helped me to know that Android has the capability of sending router advertisement without the need for installation of another module.

Related

How to scan devices on network

I am looking for a way to scan for all devices on a same network (connected to a same AP.)
For example, I have a RaspberryPi device, and I want to connect to it from Cordova app automatically - without user interaction. Therefore I thought I'd do a scan of all devices and just return the IP of Raspberry device.
I looked in Cordova plugins and only found Network Information which is not capable of doing it.
I also tried using Cordova Service Discovery plugin which does a search for active SSDP / UPnP / DLNA services on a local network. This does work, I am able to retrieve the Raspberry IP by running a SSDP service on it. How ever the problem is that it doesn't work on newest Android versions. (I didn't test on iOS yet)

Multiplexed hotspot in Android

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.

WiFi-Direct communication between Mac/Windows and Android

Is it possible to let an Android (>4.0) device establish a WiFi-Direct connection with a Mac OS or Windows device?
According to the Wifi-Direct Docs the protocol allows:
Android 4.0 (API level 14) or later devices with the appropriate hardware to connect directly to each other via Wi-Fi
It doesn't look like Google provides this functionality via the API. Although WiFi-Direct isn't a proprietary protocol and could be implemented for any platform. There are a few posts around the web of people trying to get Wifi-Direct to work under windows:
Broadcast message from Desktop PC to Android Device using WIFI connectivity
https://superuser.com/questions/417888/how-do-i-connect-a-laptop-running-windows-7-to-an-android-phone-using-wifi-direct
http://www.intel.com/content/www/us/en/wireless-products/my-wifi-technology.html
http://androidforums.com/android-lounge/552970-howto-wifi-direct-use-your-laptop-desktop-softap-android-reverse-tethering.html
All you need is to use java.net.Socket. Depends on what do you mean by establish direct connection. TCP connection is established when on destination device (windows or mac) you open listening socket by ServerSocket. On other device you can use Socket with destination address. Of course, windows or mac box will propably have to open that port in firewall.
I guess what you actually need to know is how to get name of target computer or how to discover computers on local network. Unfortunately, it does not depend on android version I think. You should check http://en.wikipedia.org/wiki/Zero_configuration_networking about some hints. I fear there might be problem in need to open privileged port on android, as normally you have to be root for that. And that would require rooted android.
Of course you should specify what do you intend with that direct connection and what software do you need. If both ends have your application, you can just open any not allocated and unpriviledged port on android. Use UDP to broadcast periodically name of android device (propably ask user to enter name of his device). Use multicast to send requests, and receive replies the same way. Multicast sending and receiving would require your application on android and on windows and on mac also. Now you can read from multicast application what type of machine it is, and what local port it left open for your direct connection. From source of udp message you know where to connect.
You may use some framework to speed things up. All this require some knowledge about networking, but I don't know simpler and well working solution. Unless you provide details about what is your direct connection to do.

Connect android 4.0.3 phone to Wifly

How do you connect an Android 4.0.3 phone to a Wifly module using level 14 API function wifi direct? I configured Wifly to work in adhoc mode, and wrote the Android app as shown in the Android.developer guide but I can not find the peer.
Since Android 4.0, it is possible to connect an Android phone to a Wifly module in adhoc mode, without rooting, with the following technique:
With a helper app (available on Google Play or develop your own), create an Access Point on the phone and inspect the SSID, passphrase and IP address.
Configure the Wifly module with this info.
In your working app, communicate with the Wifly module through standard socket programming.
These 3 steps are described in the following posts:
http://sailboatinstruments.blogspot.ca/2012/10/talking-to-android-phone-through-wi-fi.html
http://sailboatinstruments.blogspot.ca/2012/11/gps-data-from-wifly-to-android-phone.html
http://sailboatinstruments.blogspot.ca/2012/11/gps-data-from-wifly-to-android-phone_28.html
The current limitation is that the SSID and passphrase are given non-editable random names, so that you have to reconfigure the Wifly when you create a new AP (but note the AP will live on the phone as long as Wifi is enabled, unless you remove it with the helper app). Let's hope that a future Android release will remove this limitation by allowing to keep a permanent SSID and passprase.
UPDATE: With Android 4.2.1, the above limitation seems to have disappeared! The SSID and passphrase remain the same when the access point is removed and recreated.
Its not possible to work with AdHoc mode devices via Android (in iOS you can) in normal ways.
Please read here: http://www.xda-developers.com/android/android-ad-hoc-wireless-network-support/
This link shows a way to work with AdHoc.
Auto-connect: https://dl.dropboxusercontent.com/u/101922388/WiflySanUSB.zip .When only the green LED of the WiFly modem is blinking, the circuit and the program has been successfully implemented.

Android 2.2. How to set up serial port(com,rfcomm) port?

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

Categories

Resources