• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Transfer a file between Android devices?

lugopaco

Newbie
Hi! I'm making a code and I want to send a mp4 file to another Android device. I have reached to connect both Androids via Wifi and write from one a simple for cycle from 1-20 and the other Android device reads and displays the number that is sent.

Here it is the interesting part of the "sender":
Code:
                    InetAddress serverAddr = InetAddress.getByName(serverIpAddress);
                    Log.d("ClientActivity", "C: Connecting...");
                    Socket socket = new Socket(serverAddr, port);
                    connected = true;
                    while (connected) {
                        try {
                            Log.d("ClientActivity", "C: Sending command.");
                            PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket
                                        .getOutputStream())), true);
                              
                         
                            for (int i = 1; i < 20; i++) {
                                
                            
                                out.println(i);
                                
                                i=i++;
and the "receiver":

Code:
 serverSocket = new ServerSocket(SERVERPORT);
                       
                            // listen for incoming clients
                            Socket client = serverSocket.accept();
         BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()),8*1024);
This works great! But I want to send a file from one device to another instead of an int. How can I make this?????
 
I don't know anything about writing code but if it's truly a file that you want to move from one to the other you could try using dropbox. Easy to install on the phones and can be accessed anywhere you have service or wifi.
 
It is for a school project; I've to write the code so the dropbox is not a valid way =/ Anyway I already have an account. Thanks anyway.
 
Back
Top Bottom