android andftp源码,FTP, FTPS, SCP and SFTP Android client - AndFTP

AndFTP应用程序提供了一个Intent,允许用户从FTP服务器下载文件。要实现此功能,需要创建一个ACTION_PICK Intent,设置FTP URI、认证信息(如果需要)、FTP设置、下载命令类型以及本地目标文件夹等参数。例如,通过指定FTP服务器地址、用户名、密码、被动模式、下载命令和远程及本地文件路径,可以启动下载操作。完整的Intent文档和更多示例可在AndFTP论坛中找到。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Does AndFTP provide an Intent to download files from FTP server?Yes, you need to start an Activity for regular PICK intent with parameters data and the following type: vnd.android.cursor.dir/lysesoft.andftp.uri. For instance:

...

Intent intent = new Intent();

intent.setAction(Intent.ACTION_PICK);

// FTP URL (Starts with ftp://, sftp://, scp:// or ftps:// followed by hostname and port).

Uri ftpUri = Uri.parse("ftp://yourftpserver.com");

intent.setDataAndType(ftpUri, "vnd.android.cursor.dir/lysesoft.andftp.uri");

// FTP credentials (optional)

intent.putExtra("ftp_username", "anonymous");

intent.putExtra("ftp_password", "test@test.com");

// FTP settings (optional)

intent.putExtra("ftp_pasv", "true");

// Download

intent.putExtra("command_type", "download");

// Activity title

intent.putExtra("progress_title", "Downloading files ...");

// Remote files to download.

intent.putExtra("remote_file1", "/remotefolder/subfolder/file1.zip");

// Target local folder where files will be downloaded.

intent.putExtra("local_folder", "/sdcard/localfolder");

startActivityForResult(intent, 0);Full Intents documentationf2886ca5b6e5f31d68f3ad7ea3cb12ac.gif is available here. More samples are available in the forum.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值