Git Product home page Git Product logo

android-file-transfer's Introduction

The Simplest Android UDP or TCP File Transfer

  • TCP - start the server first, ServerSocket.accept() blocks
  • UDP - start the client first, DatagramSocket.receive() blocks

If you want UDP

The meat of the server/client code comes from Real's How To site.

You Need To Do:

  1. Let the 2 phones connect to the same network.

    I turned on my ad-hoc barnacle with the same name on both phones

  2. Figure out the IP address of the server. Put it under the TODO server's IP address in src/.../aaFileSTransfer.java

    You can go into ./adb shell and netcfg to see the IP If you need to change the IP, in the shell do: ifconfig eth0 192.the.new.ip

  3. Put in the file source location in the server under TODO: put the source of the file

  4. Put in the destination path in the client under TODO: Put where you want to save the file

  5. Install this "aaFile_Transfer" app on both phones

  6. On the Server phone, press "Start Server to Wait for Transmit". The button sometimes turn orange and stay that way because it's waiting for connections. Even if the button doesn't turn orange (I know, it's terrible UI), it's probably also working, so you can go on ...

  7. On the Client phone, press "Start Client Receive".

  8. On the Client phone, view if the file transfer was successful, navigate to your specified destination path using:

    • ./adb shell
    • the app: File Manager
    • The third option is to view the contents of /mnt/sdcard as a USB storage. To do so:
      • swipe down on the home view
      • select USB connected
      • click Turn off USB storage
      • Now you can view /mnt/sdcard/* as a connected USB drive

Nota Bene

  • If you downloaded to '/mnt/sdcard/download', your download might not show up in 'Downloads'

  • You might not have '/mnt/sdcard/download' directory if you have never downloaded anything on your iPhone

  • To view You might have to try disable/enable the "USB Connected" option on the phone to be able to view in

What I need to do

  • Better UI for the server button to let users know when the server is waiting for connections
  • Make a button to let server stop waiting to transfer
  • Let the user know the status of the transfer (success/fail)

If you want UDP

Just a simple UDP transmission with the meat of the code coming from helloandroid.

You Need To Do:

  1. Let the 2 phones connect to the same network.

    I turned on my ad-hoc barnacle with the same name on both phones

  2. Fill out the TODO: fill in UDP Client IP

  3. Click on the "Start UDP Client" button

  4. Click on "Start UDP Server" button

  5. Observe in logcat: D/Udp tutorial( 1167): message:Hello Android!

android-file-transfer's People

Contributors

haoqili avatar

Watchers

Sangkyun Yoon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.