Connect android 4.0.3 phone to Wifly - android

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.

Related

Android 12 WI-FI Connection

Phone Model: Google Pixel 4
Os version : Android 12
We have tried to connect Open wifi of IOT device from System but it showing obtaining IP address and never changed state of that one.
Before Android 12 it connects successfully.
Things tried to sort out
1.Forgot Device and reconnect devices.
2 Reboot device.
3.Factory Reset device.
4 Reset Network Settings.
Is there any specific reason or any problem in Android 12?
Yes, on Android 12 they introduced Concurrent Peer-to-Peer + Internet Connection.
https://developer.android.com/about/versions/12/behavior-changes-12#concurrent-connections
You can use their new APIs to get the IoT device's connection.
However I'm having a problem in my app when I try to serve a firmware upgrade using a local HTTP server on Android. NanoHTTPd seems to be using the primary Wi-Fi connection, even though the app's process is bonded to the secondary Wi-Fi.
If you find anything on that, please let me know too haha

How to send icmpv6 Router Advertisement messages from an Android device

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.

Android - Is there is a way to remotely open and debug a given Android device?

My scenario is as follow:
I'm working with an app development which a bug occurs in the app when it is in a different country than mine, and only there. The bug is related with a fail in an image download through an URL access. Right now, I haven't figured out yet what it can be. Some subjects I've already looked up are:
Its not related to internationalization and/or culture, because the code does not implement this;
Its not related to firewall/security access, because if the user in the other country opens the image's URL, he can look at the image;
Without rooting the device, is there is a way to remotely open and debug a given Android device, just like a SSH or a VNC?
Similar questions are:
Debugging android app on a device remotely
Remote Debugging
Well,
you can debug a device using a TCP/IP connection (I sometimes debug using WIFI at home). all you need to do is make sure the remote device is connected to the internet and is accessible to your PC with a direct TCP/IP connection.
As the Android device is connected in another location - you'll have to make sure your router's firewall allows outgoing connection for communications in the port ADB is using , and that the target Android device receives communications in that port (if it's behind a router - the router should allow connections under the righ port and forward all comm in that port to the android device).
in other words - you have to "tunnel" your communication to the target device. there are other tunneling solutions/products but I've never used them and I prefer the "manual" way
Good luck,
Dan
EDIT : in Android 11 - adb can work on WIFI natively : https://developer.android.com/studio/run/device#wireless
Perhaps you can have the user install something like aLogcat and have them send you a log with the failure.
Well as remotely debugging a device I don't know but you can use ACRA (Application Crash Report for Android) .
All you need is to set up a google doc, add the lib to your project and when the app crashes it will send a crash report to that google doc. See quick setup here

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.

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