|
|
|
Android FTP Connection
Android Source Code
Java program for surveillance using an Android smartphone. Webcam with FTP access to the photo storage.
The source code of the Rescue PHOTO application for Android Java.
Here is the source code for FTP to connect to the webserver. The host address and port number for connection are specified. If the connection attempt is successful, the login and password are transmitted.
Binary data transfer mode is used.
If the connection to the server does not occur, an error message is displayed (to the Android studio debug window).
public boolean ftpConnect(String host, String username, String password, int port) {
try {
mFTPClient = new FTPClient();
// connecting to the host
mFTPClient.connect(host, port);
// now check the reply code, if positive mean connection success
if (FTPReply.isPositiveCompletion(mFTPClient.getReplyCode())) {
// login using username & password
boolean status = mFTPClient.login(username, password);
mFTPClient.setFileType(FTP.BINARY_FILE_TYPE);
mFTPClient.enterLocalPassiveMode();
return status;
}
} catch (Exception e) {
Log.d(TAG, "== == Error: could not connect to host == ==" + e);
}
return false;
}
The whole procedure is completely standard. If you have successfully connected to the server via FTP, you can start downloading the file.
Safety SYSTEM >>
You can use the web page with HTML and Java Script code. Such a web page can be hosted on any hosting. Or use the PHP web page and get more information. But then your free or paid hosting must support PHP.
Android Source Code >>
The application has complex Java code. The source code spans several pages. Source codes of application modules are available on GitHub.
|
|
|
|