|
|
|
Android Read Resource
Android Source Code
Java program for surveillance using an Android smartphone. Webcam with FTP access to the photo storage.
When starting the Rescue PHOTO application, you must enter some parameters for operation: session start time, session end time, period between photos, file name template, number of photos on the web page, FTP server IP address, login, password, folder name on FTP server.
This data must be written to the smartphone's memory in order to save them for the next sessions.
Android Safety SYSTEM >>
The saved data must be read in two situations: when you wrote it (to check that the data was written) and when the application starts.
//==========================================
// Read Resource - read entered data FROM INPUT FIELDS
// Read "FTP server", "login", "password" and "folder name" into variables
// Re-shooting period in seconds - ftime, start time - stime and end time - etime in hours
//==========================================
//sPref = getPreferences(MODE_PRIVATE);
//sPref = getSharedPreferences("MyPref",MODE_PRIVATE);
// Example String savedText = sPref.getString(SAVED_TEXT, "");
//================ READ ====================
if (sPref.getString(FTP_TEXT, "FTP Server").toString() == "") {
} else {
host = sPref.getString(FTP_TEXT, "FTP Server").toString();
EditText FTPeditText = (EditText) findViewById(R.id.editText1);
FTPeditText.setText(host);
}
if (sPref.getString(LOGIN_TEXT, "").toString() == "") {
} else {
username = sPref.getString(LOGIN_TEXT, "").toString();
EditText LOGINeditText = (EditText)findViewById(R.id.editText2);
LOGINeditText.setText(username);
}
if (sPref.getString(PASSWORD_TEXT, "").toString() == "") {
} else {
password = sPref.getString(PASSWORD_TEXT, "").toString();
EditText PASSWORDeditText = (EditText) findViewById(R.id.editText3);
PASSWORDeditText.setText(password);
}
if (sPref.getString(FOLDER_TEXT, "").toString() == "") {
} else {
desDirectory = sPref.getString(FOLDER_TEXT, "").toString();
EditText DESDIReditText = (EditText) findViewById(R.id.editText4);
DESDIReditText.setText(desDirectory);
}
if (sPref.getString(FTIME_TEXT, "").toString() == "") {
} else {
ftime = sPref.getString(FTIME_TEXT, "").toString();
EditText FTIMEeditText = (EditText) findViewById(R.id.editText7);
FTIMEeditText.setText(ftime);
}
if (sPref.getString(STIME_TEXT, "").toString() == "") {
} else {
stime = sPref.getString(STIME_TEXT, "").toString();
EditText STIMEeditText = (EditText) findViewById(R.id.editText8);
STIMEeditText.setText(stime);
}
if (sPref.getString(ETIME_TEXT, "").toString() == "") {
} else {
etime = sPref.getString(ETIME_TEXT, "").toString();
EditText ETIMEeditText = (EditText) findViewById(R.id.editText10);
ETIMEeditText.setText(etime);
}
if (sPref.getString(FNAME_TEXT, "").toString() == "") {
} else {
desFileName = sPref.getString(FNAME_TEXT, "").toString();
EditText FNAMEeditText = (EditText) findViewById(R.id.editText14);
FNAMEeditText.setText(desFileName);
}
if (sPref.getString(INUMBER_TEXT, "").toString() == "") {
} else {
inumber = sPref.getString(INUMBER_TEXT, "").toString();
EditText INUMBEReditText = (EditText) findViewById(R.id.editText15);
INUMBEReditText.setText(inumber);
}
}
stime and etime - The time when the application starts taking photos and when it stops taking photos. Because when the application is running, it is not recommended to use a flash (so as not to detect the surveillance system), photographing is performed only during daylight hours. This time is set in hours.
eName = sPref.getString(FNAME_TEXT, "").toString()
Here FNAME_TEXT is a template for the name of the photo file that will be written to the webserver. This template is appended with a serial number and a standard extension for a graphic file .jpg
For example, let's set the value of FNAME_TEXT to "oflameron". Then the names of the files with photos will be as follows: oflameron1.jpg, oflameron2.jpg, oflameron3.jpg, etc.
Here INUMBER_TEXT - this is the number of graphic files (photos) uploaded to the web server, after which they will be overwritten with the same names. Those. photographs are recorded cyclically.
The number of photos in such a cycle depends on your choice, the speed of the mobile Internet (photos must have time to upload to the web server) and the settings of the web page for viewing images.
Here FTIME_TEXT - this time in seconds is the pause between photographing. During this time, the previous photo must be uploaded to the web server. If you are using Wi-Fi access, this time may be shorter. If Internet access is via LTE, this time may be longer (starts from 350-500 seconds). If you increase the time, then the number of photos per session (per day) will decrease and you will be able to save Internet traffic.
Android 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.
|
|
|
|