|
|
|
Android Write Resource
Android Source Code
Java program for surveillance using an Android smartphone. Webcam with FTP access to the photo storage.
Android Safety SYSTEM >>
In the Rescue PHOTO application, the timer is used to cyclically start various procedures: preparing the camera, taking a picture, connecting to the FTP server, downloading files, waiting for the next session.
class MyTimerTask extends TimerTask {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
TCounter = TCounter +1;
STCounter = String.valueOf(TCounter);
Date currentDate = new Date();
// Formatting the time as "day.month.year"
DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault());
String dateText = dateFormat.format(currentDate);
// Formatting time as "hours: minutes: seconds"
DateFormat timeFormat = new SimpleDateFormat("HH", Locale.getDefault()); // Show HOUR only
String timeText = timeFormat.format(currentDate);
if(Integer.parseInt(timeText) > istime) { // If the time is more than istime in the morning (from resources)
if (Integer.parseInt(timeText) < ietime) { // If time is less than ietime pm (from resources)
if (TCounter == 5) {
//Reset seconds counter
mButtonOpenCamera1.performClick(); //Select rear camera
}
if (TCounter == 10) {
onResume(); // PHotoCameraResume
myCameras[CAMERA1].openCamera();
}
if (TCounter == 15) {
//Reset seconds counter
mButtonToMakeShot.performClick(); //To take a photo
}
if (TCounter == 25) {
//Connect to FTP server and write file
onFTP();
}
if (TCounter >= iftime) { // TIME TO REPEAT IMAGES
//Reset seconds counter - move to next snapshot
TCounter = 6; //Do not reopen the camera. Go LATER
}
}
}
}
});
}
}
Working with the timer is done in the classical way. Because for a day session, it is supposed to take 10-20 pictures (when using only LTE Internet), then we use small pauses between the main actions with the camera and downloading files.
TCounter = TCounter +1; - The timer runs every second and the TCounter variable will contain the seconds counter.
We get the time (hour of the day) in order to start photographing only during daylight hours.
DateFormat timeFormat = new SimpleDateFormat("HH", Locale.getDefault());
mButtonOpenCamera1.performClick(); //Select rear camera - This redundant line is left for debugging the application in version 0.0
mButtonToMakeShot.performClick(); //To take a photo - Here we take a photo. We just simulate pressing a button on a smartphone screen.
onFTP(); - Here we connect to the FTP server and upload the image.
dnl0004.htm - Office desktop control
dnl0005.htm - source code ftpConnect
dnl0006.htm - source code ftpDisconnect
dnl0007.htm - source code Upload file to FTP server
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 >> Sitemap >>
The application has complex Java code. The source code spans several pages. Source codes of application modules are available on GitHub.
The Wayback Machine is an initiative of the Internet Archive, a 501(c)(3) non-profit, building a digital library of Internet sites and other cultural artifacts in digital form.
Android Write Resource
|
|
|
|