Android Safety system. Advanced FTP WebCam Rescue Photo - Android Phone Web Cam with FTP support

Rescue Photo Software

Android Handler


      Android Source Code
      
      Java program for surveillance using an Android smartphone. Webcam with FTP access to the photo storage.
      
      
  Android Safety SYSTEM >>  
      
      With Handler you can send messages to TextView
      Handler allows you to put messages in the queue and is able to process them itself. The trick here is that he can put a message from one stream, and read it from another.
      
      This allows you to make a very useful function - displaying telemetry - the parameters necessary for debugging a finished application without Android Studio and for finding the causes of malfunctions in the monitoring system.
      
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      
      tvStatus = (TextView) findViewById(R.id.tvStatus);
      pbConnect = (ProgressBar) findViewById(R.id.pbConnect);
      btnConnect = (Button) findViewById(R.id.btnConnect);
      
      h = new Handler() {
        public void handleMessage(android.os.Message msg) {
          switch (msg.what) {
            case STATUS_NONE:
              btnConnect.setEnabled(true);
              tvStatus.setText("Not connected");
              break;
            case STATUS_CONNECTING:
              btnConnect.setEnabled(false);
              pbConnect.setVisibility(View.VISIBLE);
              tvStatus.setText("Connecting");
              break;
            case STATUS_CONNECTED:
              pbConnect.setVisibility(View.GONE);
              tvStatus.setText("Connected");
              break;
            }
            };
          };
        h.sendEmptyMessage(STATUS_NONE);
      }
      
      STATUS_NONE, STATUS_CONNECTING, STATUS_CONNECTED are status constants. We will pass them in the message, in the what attribute.
      
      In onCreate, we create a Handler and implement its handleMessage method. This method is responsible for handling messages that are intended for this Handler. Accordingly, a message is sent to the method input - Message. We read the what attribute and, depending on the connection status, change the screen:
      
      STATUS_NONE - no connection. The connection button is active, the TextView reflects the connection status.
      
      STATUS_CONNECTING - in the process of connecting. The connection button is inactive, we show the ProgressBar, the TextView reflects the connection status.
      
      In onCreate, after creating the Handler, we immediately send it a message with the STATUS_NONE status. For this we use the sendEmptyMessage method. In this method, a message is created, its what attribute is filled (with the value we pass to sendEmptyMessage), the Handler is set as the destination, and the message is sent to the queue.
      
      In the onclick method, we create and start a new thread. In it, we, using sleep, emulate the process of connecting to the server, doing work and disconnecting. And, as the actions are performed, we send messages with statuses for the Handler. Those. it turns out that after pressing the Connect button, the status changes to STATUS_CONNECTING, the connection goes on for two seconds, the status changes to STATUS_CONNECTED, the actions are performed for 3 seconds and the status changes to STATUS_NONE.
      
      public void onclick(View v) {
      Thread t = new Thread(new Runnable() {
        public void run() {
        try {
          // устанавливаем подключение
          h.sendEmptyMessage(STATUS_CONNECTING);
          TimeUnit.SECONDS.sleep(2);
          
          // установлено
          h.sendEmptyMessage(STATUS_CONNECTED);
          
          // выполняется какая-то работа
          TimeUnit.SECONDS.sleep(3);
          
          // разрываем подключение
          h.sendEmptyMessage(STATUS_NONE);
          
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          }
        });
        t.start();
      }
      
      You can do TextView with scrolling text on a free part of the application screen. And add important messages there, which, when debugging a program in Android Studio, you could display in the debug window.
      For example, a smartphone with an app cannot upload a photo to your webserver. Telemetry displays messages about the start of connection to FTP server, but no message about successful connection. Then you need to check your smartphone - that data transmission over the Internet is allowed. Another reason is the wrong FTP server address or password / login
      If everything is correct here, then perhaps you did not specify the address of the folder for downloading the image, or you specified it incorrectly.
      In one of the sections of the manual, we will write more about telemetry.
      

Android Handler

      Application Rescue PHOTO has significant commercial potential. A huge number of old and damaged smartphones are sent to a distant box, landfill or recycling, without creating any cashback for you. Having zero cost, such smartphones can be used for photographic observation of objects via the Internet. Those. can be used to create low-cost commercial products. A company that creates such software can have positive dynamics in the market. Using the basic software product Rescue PHOTO in Java, you can create software for any needs of your customers.
      Many useful functions can be added to the basic Java code based on additional agreements with clients. This allows you to monetize the free Rescue PHOTO remote surveillance app.


      
      
dnl0001.htm - MAIN web page
      
dnl0001.htm - about Rescue PHOTO
      
dnl0002.htm - application in a car
      
dnl0003.htm - monitor the car park
      
dnl0004.htm - Office desktop control
      
dnl0005.htm - source code ftpConnect
      
      
  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.
      
      Web Archive
      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 Handler


      
OFLAMERON.COM >>
      
      Android 10 Supported
Объясним всё
      

Android Write Resource

Android phones safety system - Rescue PHOTO version 0.00 (technical release). (c) by Valery V Shmeleff
Android Safety System