Android USB application - java

I have a have been doing my research on a program in which an android application makes a communication with a Desktop computer through a USB connection. I did find out that Android 3.1 allows USB communication, but I have no idea how to proceed on it. I'd be very helpful if someone could tell me how this is done.
Thanks
Nik

You can use this API.
Accessory Development Kit
More detailed information can be had from this link as well.
Android apps, communicating with a device plugged in the USB port
I am not sure you can test this using an emulator.So develop an application and deploy it in a real device and connect that device to your PC via USB port for testing.

Related

PC to Android communication over USB cable

I need to make communication between PC software (written in java) and android app over usb cable. The PC software will send some data (Strings) to Android app witch will accept those strings and do some action depending on the message received.
What is the best way to do this?
I am looking all over the internet and can't find any solution to this. If someone has example of this communication i would be very grateful.
I already done this communication over sockets, put i need to cover situation if there is no router or internet connection.
Thank you
Check following article. I guess similar question to your on SO.
If you want to communicate between Android USB device and some USB host you need to use the accessory mode (https://developer.android.com/guide/topics/connectivity/usb/). But this mode requires special driver support on the USB host side (which is your PC).

Debugging app from the device without USB and WIFI

Since my app runs on the emulator and crashes on my device. I would like to see log report of my app directly from the device. So that it might lead to better way of debugging. But I have following problems
My device is connected to the PC via LAN.
My device doesn't have USB connection (no slave port).
I am using android studio as IDE. I have seen couple of examples which could be used if the device is connected to same wifi network like Debugging over wifi network but this doesn't help.
There is an official documentation with wifi official documentation for wifi still it needs USB connection in step 3.
Does Android Studio provide any type of solution?
if your app is firebase configured maybe you can use DebugView from firebase site.
To get the crash reports from any android device you can use crashlytics..
This is very nice library which provides you very details logs of crash along with many other details like android device name, ram size, memory, orientation etc..
Good thing is that this crashlytics was different library previously, which is now part of Firebase .
To get started you can know about crashlytics from here you can follow the documentation from here
Actually, firebase helps you get the crashlytics. The error message will be stated in the dashboard once the app crashes. This is a life saver but I found out that, we can simply connect the device to IDE without USB. Just the PC and your device should be connected via LAN
Using ADB tool. Run the adb.exe file as admin. Connect using tcp. Just address and Port is necessary.
You can simply debug from the IDE, In my case android studio.

biometric authentication java aplication. how to build the connection between an smartphone and application

I have to develop an biometric authentication application.
The application will be written in java and it will be an desktop app, I want to use my smartphone for the fingerprint sensor, but I don`t know how to build this connection betwenn application and phone.
The main application will be installed on a computer without web.
I would be grateful if you have any idea or examples how to do this. Thank you!
You should have an app on your smartphone which uses the fingerprint authentication API.
If you are looking to use an android phone, you can refer this
https://developer.android.com/about/versions/marshmallow/android-6.0#fingerprint-authentication
You can create a simple APP using this API.
When user authenticates, then you can send message to your desktop java application from this App.
By 'without web' if you mean without internet, but can be connected to a local network, then you can send message via TCP/UDP.
Or if you wont be able to connect to any network, then you can try bluetooth.
If bluetooth is also not available, then you can connect your phone to your computer via a USB cable and communicate using Serial communication. There are a few external libraries available for this.

Finding and Android NSD-Service from a non-Android Device

Since Android 4.1 Network service discovery (NSD) is available. However, how would one find an android device that exposes an NSD-Service from a computer or from some other device that does not run android. Building an android app as shown in the examples will find the other device just fine, however, one does not always have Android as a platform.
I am running UPnP discovery on my PC and the phone does not show up.
You can find my NSD-Service implemented here on github.
The Discovery app is simple from the android example.
The UPnP example is using Cling and is from their tutorial it finds my router and the windows media player so I assume it works.
It may be that the issue is based on a mismatch of service discovery protocols, I relay am confused as to the differences between NSD, UPnP, Bonjour, Zeroconf and all the other possibilities...
The protocol you are after is http://www.dns-sd.org/ - DNS Service Discovery (DNS-SD)
That seems to be the only protocolType in the current Android framework.

write to android USB port and send it to a RS232 microbot port

I have an old android phone (2.2) and I need to use it to transfer a (.tok) file to Basic Stamp micro RS232 using a USB-Serial converter in between. So bluetooth is out of question. My only option is to write to the USB port of my android and make the BS2 micro receive it.
I`ve never programmed Android so need some guidance as to how I do this, specially when my api level is 8. I need a simple program that reads a downloaded (from the processing local linux PC) file from sdcard and then send it to USB port without any processing. That file is then received by the RS232 port of bot.
Android 2.2 API does not have USB host capabilities.
Host capabilities was not made available until Android 3.1.
This means you can't write an android program on your v2.2 phone that will control the USB communication.
I'm also guessing that even if you did update your OS, the phone doesn't have a USB-A port necessary to power the bus.
no need "usb host", work an older android devices like 2.2 http://code.google.com/p/android-serialport-api/

Categories

Resources