Using Wifi Direct to connect an Android App to PC - java

I am developing an android app which needs to communicate with a PC and exchange real time data.
I am trying to use Wifi Direct to do so (http://developer.android.com/guide/topics/connectivity/wifip2p.html). While it is easy to transfer data between two android devices using this technology, I am not sure how I can do the same between an android device and a PC. From what I researched, I found out that the PC needs the 'Intel My Wifi Dashboard' and 'Intel Pro Wireless Tools software' products to be able to use WiFi Direct.
My question is: Is it possible to code an interface or en quivalent Wifi Direct API that can work for PC which can replace these Intel software products so that the PC doesn't have to depend on the installation of these products and my app can directly communicate with PC?

I have tried file sharing and other media sharing through Intel WIFI Direct technology to ANDROID WIFI Direct. But it doesn't work as per my experience. It shows devices connected with WIFI Direct and file sharing not supported :) funny but sad !
So my advice would be, first explore whether you can at least connect and do some operations on ANDROID PHONES with Intel software installed on PC. Try with different devices. Don't forget to turn off your firewall on android as well as PC !
If your experiment works, then dig deeper to find about API's. This technology is still in its nascent stage. GOOD LUCK :)

https://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=21165 , you can force download this version of Intel WiFI Dashboard.
Point -> this is not the one which enables WiFi Direct on PC. You need drivers that come with 'Intel Pro Wireless Tools software'. Once that is installed you should directly install Intel WiFi Direct (WiDi)
Question -> Which WIFI Adapter are you using ? Right now not all the adapters support WiFi Direct API's. If you are trying to reuse intel API's then you will have to find right adapters. Also what do you mean by real time data ? Do you want to exchange photos/videos/files ? Or you want to Mirror your screen/video steaming real time ? Please do reply, even I am interested in this field :)
https://downloadcenter.intel.com (Select below options from dropdown)
Product family
==> Wireless Networking
Product line
==> Wireless Technologies
Product name
==> Intel® Wireless Display (Intel® WiDi)

if you are looking to write an app to do this, I would start off at the wifi alliance and pick up the whitepaper detailing the spec... here is a link.
https://www.wi-fi.org/knowledge-center/published-specifications
http://www.wi-fi.org/discover-and-learn/wi-fi-direct <<

Related

Is there an API available for using the Samsung TV network remote control feature?

I want to write an Android app which controls my Samsung TV via the wifi network. This is possible because there are apps out there that do it (including Samsung's own remote app).
Is there a Samsung API available to do this? How does the app talk to the TV?
There is an open source project of SamyGo, and it works perfect. I am using it on my android phone and with the help of that project source, I created a little remote control with c#. You can always check their offical forum link for latest news.
http://sourceforge.net/p/samygo/code/1286/tree/
http://forum.samygo.tv/index.php
this seems to be a good start (Samsung SDK for their TVs):
http://www.samsungdforum.com/Devtools/SdkDownload
I've used this for PC based Java apps and it works well ... might be of some use:
https://github.com/mhvis/samsung-tv-control

Get info about computer to which Android device is connected

I have the problem. When Android device connected to computer through USB, I need to get information about this computer(such IP, Host Name or something like this). Is it really to get?
Thanks.
As #home indicated, this is not possible.
I believe this may be interesting read for you:
http://code.google.com/p/android/issues/detail?id=738
however, USB host feature has just been released and is available starting with honeycomb. this may eventually help you introduce your own communication between devices, but you'll need to write some code for PC too.
If you hope to do it directly while device is working as UMS, WMS or vendor specific portal - well, it could be possible, but this certainly will be phone specific (especially when your phone turns into multi-function device the way Motorola Droid does).
There is no typical mechanism to do that.

USB device for Android

I have a usb device that I have been using in windows OS. I am to connect that device to an Android Tablet. Can you suggest some API for developing my programs to communicate over the USB device using Android Operating system.
Thank you so much for your interest
I think you can only do this on a rooted phone, and it is a complicated and "unsafe" process.
You can check this other post in stackoverflow forums where other references are mentioned. Some people have managed to do this but with rooted phone and some tricks, and also some projects are mentioned that were considering USB connection as a future goal, even though such development might not have been yet achieved. The link is: Android apps, communicating with a device plugged in the USB port

using serial port RS-232 in android?

I want to send signals via serial port using the JavaComm API classes on an Android device, and here is how I imagine it:
1- the Android device would be: Archos 3.2 which has android 2.2 and USB host mode.
2- include RxTx lib package with my Android app. and include RxTx native code using Android NDK.
3- a short cable which is usb-->serial.
Could you explain to me where I might face problems?
I just ported the JavaCOMM ( GNU RXTX ) library to the Android. Here is the link http://v-lad.org/projects/gnu.io.android/
You still might need to rebuild your kernel and maybe recompile the shared library for your environment. But this should get you started.
As noted above, you'll need to come up with device drivers for whatever USB<->Serial device you have. Many of these devices use the Prolific PL2303 chip:
http://www.qbik.ch/usb/devices/showdr.php?id=175
which the stock linux kernel has support for, and has had for a long time. I've used this and it works fine, so I would recommend you stick with USB<->Serial devices that use this chip.
Beyond that, with udev these devices normally show up as /dev/ttyUSB#. How that happens with Android, I don't know, so you'll need to figure that out.
Finally, you will need to build the RxTx native code. This code is pretty crufty - I had problems building it on a fairly modern Angstrom, and I was not trying to cross-compile at all.
Unlike the regular PCs, most of the stock kernels for the android devices come with minimum compiled modules. You need to recompile the kernel with enabled drivers for USB to serial converters. You luck depends on the specific device that you using. A lot of manufactures violate GPL, by not providing the kernel source code. Some manufactures like Motorola with the Droid 2 require signed kernel. Which makes it impossible to load custom kernel on the device.
Also, although many devices have USB host mode you have to jump through the hoops to switch the device mode. For example Motrola droid requires a special dongle to be plugged in into the USB port before powering on to switch into the host mode.
Here are some links for you that explain what you need to do:
“More on Droid host mode,” http://www.tombom.co.uk/blog/?p=134.
“USB Host mode on Motorola Droid,” http://www.tombom.co.uk/blog/?p=124.
Yes, it's definitely a mess to use the serial devices from the phone side on the Android. The problem is that the various devices present on the AOS is not documented, and rarely coincides with standard Linux ones. Thus you are never sure what/who you are actually talking to, some device, abstraction layer (HAL, UART,PCI etc). Here is a tutorial on how to talk to a serial device (the modem) from an externally USB connected PC.
In any case, if your phone does support USB host mode, there have to be another way to reach your serial port/devices using that. After all, backward compatibility does often insure some kind of FAX, telephony or external modem support from your USB cable. Also there is tehtering which may also contain some virtual serial device...
There is a tutorial for some of this here.
PS. The main problem of such programs (like that of Vlad) and applications (like serial-api) are that they make too strong assumptions on the device/port names and the permissions needed to reach (read/write) these...
Probably not exactly what you're looking for, but this instructable might point you in the right direction
The biggest problem is probably the USB->Serial Adapter:
You need the either a device driver for the USB Serial Driver, which is probably not included in the android kernel.
The other option is to use something like libusb (which may have to be ported to android as well) and a user space driver based on libusb.
What you need to do first is to root the tablet in order to get Read/Write access to the serial ports.
After you do this take a look at Android Serial Port API. You can download the source code and see how it is implemented.
It has a native lib that gets a file descriptor to the serial ports and then you can read and write to the ports. Usually the app may not list all the available ports on the tablet. To see where your device is connected, plug it in the USB with HostMode, and in an Emulator type "dmesg | tail". It should give you details about the device, and the port that is connected to.
I also used an Archos Tablet, mine device was connected to "/dev/ttyACM0".
Good Luck!
I've done this.
You need to:
1. Root the device.
Create your own module for the specific USB chiset you're about to use: Building kernel module for Android
I recommend using the ported usb-serial-for-android library, which has the PL2303 driver already implemented:
https://code.google.com/r/felixhaedicke-usb-serial-for-android

Is there a way to communicate with USB devices on Android?

I have a really short question: Is it possible to communicate/use USB devices on Android OS? I assume it might be tablet device.
Lest say i want to connect some sort of USB card scanner to android tablet. Will it work? Do i need to write drivers by myself?
Thanks.
First, you need a USB host port on your tablet. Except for On-the-Go (which is a special design that can be either host or device), it is not possible to connect two USB devices together. The incompatibility is electrical, no amount of software changes can make it work.
Yes, some phones can work as hosts, like the DROID. Do a Google search for connecting a USB keyboard to an android phone, such as here: http://www.tombom.co.uk/blog/?p=124
Yes, it will work, and you do not need to write drivers for the Android side. However, the device must support the open accessory protocol and must be able to supply power to the Android device. A development kit is available.
However: "Accessory mode is ultimately dependent on the device's hardware and not all devices support accessory mode."

Categories