Application not found

FTP client for Android handsets.
Post Reply
raybenjamin
Posts: 2
Joined: Mon Jun 03, 2013 3:49 pm
AntiSpam sum: 8

Application not found

Post by raybenjamin »

I'm using AndFTP in an application to upload a zip file to a server and download some data files from the same server. When I run the program, I get an error saying that it can't find an application for the intent. I'm building the intent as per the documentation.

Can you give me some idea of what I'm doing wrong? I'm sure it's probably something stupid, but
I'm going cross-eyed staring at it.

Thanks,
Ray

Here's the code:

Code: Select all

        // FTP Intent Keys
	static final String FTP_USERNAME = "ftp_username";
	static final String FTP_PASSWORD = "ftp_password";
	static final String FTP_PASV = "ftp_pasv"; // true false
	static final String FTP_RESUME = "ftp_resume"; // true,false
	static final String FTP_ENCODING = "ftp_encoding"; // UTF-8, SHIFT-JIS,
														// CP1251, EUC-KR, BIG5,
														// GBK
	static final String FTPS_MODE = "ftps_mode"; // implicit, explicit
	static final String COMMAND_TYPE = "command_type"; // upload, download
	static final String REMOTE_FILE_X = "remote_file"; // append digit, e.g.,
														// remote_file1 ==>
														// filename
	static final String LOCAL_FILE_X = "local_file"; // append digit, e.g.,
														// local_file1 ==>
														// filename
	static final String LOCAL_FOLDER = "local_folder"; // local folder for
														// upload
	static final String CLOSE_UI = "close_ui"; // closes the progress window
												// after transfer.

	// FTP Returned Intent Keys
	static final String TRANSFER_STATUS = "TRANSFERSTATUS"; // s/b COMPLETED,
															// FAILED, CANCELED,
															// UNKNOWN - always
															// returned
	static final String TRANSFER_AMOUNT = "TRANSFERAMOUNT"; // count of files
															// transfered -
															// optional
	static final String TRANSFER_SIZE = "TRANSFERSIZE"; // # of bytes in overall
														// transfer - optional
	static final String TRANSFER_TIME = "TRANSFERTIME"; // duration of transfer
														// - always returned

	// FTP Request Codes
	final int BROWSE_REQUEST = 1421; // numbers have no particular significance.
	final int PICK_REQUEST = 1422;
	final int UPLOAD_FILES_REQUEST = 1423;
	final int UPLOAD_FOLDER_REQUEST = 1424;
	final int DOWNLOAD_FILES_REQUEST = 1425;
	final int DOWNLOAD_FOLDER_REQUEST = 1426;

	final static String FTP_APP = "vnd.android.cursor.dir/lyesoft.andftp.uri";

	final static String UPLOAD_DIRECTORY = "/mnt/sdcard/Android/Data/com.pbs.deliverytrack1/files/";
- and -

Code: Select all

Intent intent = new Intent();
			intent.setAction(Intent.ACTION_PICK);
			intent.setDataAndType(ftpUri, FTP_APP);
			intent.putExtra(COMMAND_TYPE, "upload");

			intent.putExtra("ftp_pasv", "true");
			// intent.putExtra("ftp_resume", "true");
			// intent.putExtra("ftp_encoding", "UTF-8");

			intent.putExtra("ftp_username", driver.getUserName());
			intent.putExtra("ftp_password", driver.getPassword());
			// intent.putExtra("ftp_keyfile", "/sdcard/rsakey.txt");
			// intent.putExtra("ftp_keypass", "optionalkeypassword");

			// Get upload files, the ones with the zip extension
			File path = getExternalFilesDir(null);
			File fileList[] = path.listFiles(filter); // filter just selects *.zip files
			int count = 1;
			for (File file : fileList) {
				Log.d(tag,
						"Adding file " + count + ". " + file.getAbsolutePath());
				intent.putExtra(LOCAL_FILE_X + count, file.getAbsolutePath());
				++count;
			}
			// Send Intent
			startActivityForResult(intent, UPLOAD_FILES_REQUEST);

Post Reply