Android 手机开启FTPServer服务,设置用户信息密码等,服务的ip地址就是本地的ip地址 摄像机在通信里面选择FTP方式,然后连接可以 implementation 'commons-net:commons-net:3.8.0' implementation 'org.apache.ftpserver:ftpserver-core:1.1.1'
packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' }
public class FTPLogin2Aty extends AppCompatActivity { private EditText textName,textIp,textPwd; private Button btnLink; private FtpServer mFtpserver; private String filePath; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ftplogin_aty); initView(); initData(); } private void initView(){ textIp = findViewById(R.id.address_ip); textName = findViewById(R.id.address_name); textPwd = findViewById(R.id.address_pwd); btnLink = findViewById(R.id.address_btn); btnLink.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LinkServer(); } }); } private void initData() { // String albumPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutepath(); // File internalStoragePath = getFilesDir(); // filePath = internalStoragePath.getAbsolutePath(); String albumPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath(); filePath = albumPath; } private void LinkServer(){ try { startFtpserverNew(getIpAddress()); }catch (Exception e){ } } private String g