FTPS connection in android
<p>I am new to android, i want to download the files from FTPs server, On emulater i am able to download files but when i try on target board it is giving error at ftp.auth(SSLFTPClient.AUTH_TLS);</p>

<p>Below is the my code, please suggest me where i am wrong.</p>

<pre><code>package com.android.ftp;

import java.io.File;

import android.app.Activity;
import android.os.Bundle;

import com.enterprisedt.net.ftp.FTPClientInterface;
import com.enterprisedt.net.ftp.FTPConnectMode;
import com.enterprisedt.net.ftp.FTPTransferType;
import com.enterprisedt.net.ftp.ssl.SSLFTPClient;
import com.enterprisedt.util.debug.Level;
import com.enterprisedt.util.debug.Logger;

public class Ftp_testActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    String host = "ftp.xyz.com";
    String username = "abcd";
    String password = "pqr";
    String filename = "/mnt/sdcard/video1/747.3gp";


    // set up logger so that we get some output
    Logger log = Logger.getLogger(Ftp_testActivity.class);
    Logger.setLevel(Level.INFO);

    SSLFTPClient ftp = null;


    try {
        // create client
        log.info("Creating FTPS (explicit) client");
        ftp = new SSLFTPClient();

        // disable standard SSL closure
        log.info("Setting configuration flags");
        ftp.setConfigFlags(SSLFTPClient.ConfigFlags.DISABLE_SSL_CLOSURE);


        // set remote host
        log.info("Setting remote host");
        ftp.setRemoteHost(host);
        ftp.setRemotePort(21);

        // turn off server validation
        log.info("Turning off server validation");
        ftp.setValidateServer(false);

        // connect to the server
        log.info("Connecting to server " + host);
        ftp.connect();

        // switch to SSL on control channel
        log.info("Switching to FTPS (explicit mode)");
        ftp.auth(SSLFTPClient.AUTH_TLS);

        // log in
        log.info("Logging in with username=" + username + " and password="
                + password);
        ftp.login(username, password);
        log.info("Logged in");

        ftp.setConnectMode(FTPConnectMode.PASV);
        ftp.setType(FTPTransferType.ASCII);

        putGetDelete(filename, ftp);
        log.info("Successfully transferred in ASCII mode");

        // Shut down client
        log.info("Quitting client");
        ftp.quit();

        log.info("Example complete");

    } catch (Exception e) {
        e.printStackTrace();
    }
  }


  private static void putGetDelete(String name, FTPClientInterface ftp)
        throws Exception {
    ftp.put(name, name);
    ftp.get(name + ".copy", name);
    ftp.delete(name);
    File file = new File(name + ".copy");
    file.delete();
    }
}
</code></pre>
