Results 1 to 3 of 3
  1. #1
    jvb2008 is offline Member
    Join Date
    Mar 2017
    Posts
    9
    Rep Power
    0

    Default Data write and read via USB Cable

    Hello!

    I am programming an Android application that sends data to a PC software. Right know, I am using socket communication via IP and a PORT. I want to add a new type of communication writing and reading data using my usb cable (USB communication -- Nexus 7). Could you give me info about how to do this type of communication?

    Thanks in advance and best regards

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Data write and read via USB Cable

    I presume by "new" you mean other than IP based sockets. Well, to write data via an type of interface (usb, parallel, ethernet) you usually need a driver for the OS you are using. Then you would need an API which allows I/O calls to write the data. Typically these are programmed using the JNI (Java Native Interface) interact with the OS and the aforementioned driver. So Android may already have that. But you would need something similar on the PC to accept the incoming data. It does not have to be Java, just something that correctly reads USB sourced data. If you are writing that yourself, then you need to search for the OS driver and particular language API that will allow you to access the port. Of course, depending on one's experience, they could write their own drivers (but that is an entirely different world that simply application programming).

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,007
    Rep Power
    34

    Default Re: Data write and read via USB Cable

    Have you tried an internet search?
    Here is one page I found: Android write files to USB via OTG cable - Stack Overflow
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 1
    Last Post: 04-11-2014, 02:39 AM
  2. Replies: 0
    Last Post: 11-12-2013, 07:30 AM
  3. Replies: 1
    Last Post: 09-06-2012, 11:53 AM
  4. How to read and write data via Serial Port
    By Khan05 in forum New To Java
    Replies: 0
    Last Post: 07-28-2011, 09:32 PM
  5. How do I write or read data text?
    By off99555 in forum Advanced Java
    Replies: 1
    Last Post: 12-08-2010, 10:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •