LCD4Android – display informations from your Android devices

 
1. Introduction
 
Do you know something about LCD4Linux project? Yes, it's project, which allows on displays various information on LCD display via USB. You need module, display LCD, and… own or someone else soldering skills. I don't quarrel – it's good project, I myself have 2 these display LCD connect to LCD4Linux module.
 
Is also other way. On auction portals you can buy cheap tablet or tablet with damaged battery with Android system. Problem may be is in writing or founding app, which allows on displays information on Android device. For this purpose I write app LCD4Android.
 
2. What is LCD4Android
 
LCD4Android is app on Android system, which allows on displays various information on Android systme.
Features:
  • free,
  • without ads,
  • works on Android 4.4 KitKat, above,
  • during running doesn't allow for switching screen to off,
  • the data are display in WWW browser based on WebKit engine,
  • require knowledge HTML langugage and JavaScript,
  • the data can be received: from server, via Bluetooth, or via USB.
 
3. License, source code and installation
 
I grant license CC BY-SA 4.0 (http://creativecommons.org/licenses/by-sa/4.0/)
Source code is on GitHub portal (https://github.com/nitro2010/LCD4Android)
 
You can find latest version app – click on 'Releases' and LCD4Android-version.apk. Install this app yourself – via ADB, AirDroid, you can move app to SDCard via USB cabel, and then install app from file manager. App isn't in Google Play. App which I issue, is signed key.
 
4. Usage
 
Note: Examples and programs was testing on Linux Mint
After installation we run app. App will run on full screen without any taskbars, horizontally, it doesn't allow on run lock screen. Extra menu we have under MENU key.
 
Welcome page LCD4Android
 
As I mentioned earlier, the application displays the data in HTML format, with mixed of JavaScript.
The application displays the information on the form the browser with the following settings:
  • none horizontal and vertical sliders move (it is still possible to move with your finger)
  • JavaScript enabled,
  • Pop-up Blocker enabled,
  • Zoom buttons disabled,
  • implemented interface 'AndroidJS' for communication between JavaScript and Android
The application currently supports 3 modes of obtaining information that is available in MENU => Choose connection type:
 
  1. Server WWW
 
In this mode data are received from server WWW. We create server HTTP, create pages, which read data from server or something display. Transitions between the parties can be done by adding, for example.:
where after 10 seconds the page will go to the page named ekran2.html
As an example, I created 2 pages: datetime.html (which displays the current date and time) and memory.html (which shows the amount of memory used Linux system). Both scripts use jQuery. In addition, we have a bash script memory.used.sh that writes to a file memory.used.txt current memory usage. For example, cause it definitely should every 1 second:
We give the files to your web server, you can give the above line to the screen command.
In the application, change the URL: MENU -> Change Server URL is the address of the server. For me is this: 192.168.1.185:8080/datetime.html, and we confirm the information from the server.
 
     
Screenshots showing the data from the server: time and memory load bar​
 
On the server we can do what we want and what language you want as long as the result to the browser will be sent as text/html and encoding utf-8.
It should also be noted that our information does not go beyond the screen of the device.
 
Source code: lcd4android_conn_www.zip (you can download it from Download section -> Scripts)​
 
  1. Bluetooth
 
In this mode, we are able to send data (text) from another device. When you select this mode, you see on the screen, "I am waiting for data from Bluetooth Device". The device listens on two channels: a safe and unsafe. Type can be selected from the menu, but it's better to leave both. Now you only need to write an application that will send the text to our main application.
 
ID secure channel:        a1869bd4a0d647a3886db8d7579f8cc7
ID insecure channel:    4f41adbe088a48b3b77db90a5b65d7e8
For testing purposes, I created a Java application that uses the library BlueCove to transfer data via Bluetooth.
Application Sources: JavaBluetoothEchoClient.zip (you can download it from Download section -> Scripts)
Application: bluetooth_client.jar (you can download it from Download section -> Programs)
It can be called from Windows and Linux.
First, create a file called file.txt say with any text. We can also add HTML tags.
java -jar bluetooth_client.jar discovery – shows all nearby Bluetooth devices that have the visibility.
java -jar bluetooth_client.jar service-secure FILE DEVICE – transmits the contents safe channel FILE [give the path to this file] to the device DEVICE [give ID device].
java -jar bluetooth_client.jar service-insecure FILE DEVICE – transmits the contents insafe FILE [give the path to this file] to the device DEVICE [give ID device].
 
An example of how you can see in the following screenshot:
 
And our application LCD4Android receives content sent from JAVA:
 
 
This method rather send static text. Images should be avoided to transfer.
 
  1. USB cabel
 
In this mode, data is read by the USB cable. More specifically, the data is sent to the phone and this phone is read the data. Data can be transferred by the ADB. We can send immediately all the html and javascript files to your phone.
Here's how step-by-step:
  1. To create the root file name: lcd4android.html. In this file, put a major and essential part of our application. For this we give different javascript files that are needed for our application.
  2. We pack our files into one zip file.
  3. We send the data to the phone. And here is the relationship from which one can read the location of the application:

     

    1. /data/data/eu.webnitro.lcd4android/files/ – internal folder in the system
    2. /storage/sdcardX/eu.webnitro.lcd4android/files/ – a folder on the internal or external
  4. addition, the app will read one of the two folders called 0 or 1. The folders are designed to synchronize. If your current application reads from 0 to send the folder to 1 if the 1 to a 0.
  5. Extract the files to your phone from the archive.
  6. We are sending the file as a file synchronization lcd4android.page.
The application reads every 5 seconds if you have a file synchronization to change the folder and read another html file.
Note! You can also send by ADB wirelessly, just install the program on your phone, for example: Adb wifi.
For this purpose I created for Linux BASH script adb_shell.sh (you can download it from Download section -> Scripts)
It is important to have adb installed on your system.
My script can send data through ADB over WiFi or USB.
This mode is set in the variable type_connection – if you want to send via USB set usb if the wifi – net.
Then, depending on the type of connection – if we chose a variable set connection_net WiFi, where we give the IP address and port on which the ADB listening on your phone, if you selected the USB in the variable ID connection_usb give the phone. We can get it by adb devices.
The variable we set path_files where we have saved html and javascript files to be loaded into the phone.
The latter part is divided depending on the connection, but the two parts do the same:
– Takes the path where the files to be loaded from the application settings file
– Packed files in a folder on your computer
– Determine the folder where 0 and 1 will be loaded zip archive
– Sends the archive to a folder to your phone
– Extracts the files on your phone
– Sends the file synchronization
 
In this way, your phone should appear in the new content.
As an example, I used the clock in the previous section. Just load the archive and a clock appears on the screen of your phone.
 
Note: In version 0.6 there is a problem such that if we use the usb after you close and restart the application does not know why re-read the file from 0. The reason is Constants.USB_PAGE variable that takes the value of 0, even if the file does not exist synchronization. Fortunately, if you come 2 new content will be displayed.
 
source code: lcd4android_clock.zip (you can download it from Download section -> Scripts)
 
AndroidJS Interface
The application has been implemented on a special interface called AndroidJS, which combines JavaScript with Android. Not everything can be done with JS on Android. Currently allows you to sound the alarm at PlayAlert() function. You can also add other useful features.
 
PlayAlert() – plays a sound file – alarm on your phone
As an example, the bar has been created, where every second there is a new value when it exceeds 90% of the beep.
This function can be used when, for example. Is not enough memory in the system.
Be sure to yourself manually adjust the volume.
 
source code: lcd4android_randomprocessor.zip (you can download it from Download section -> Scripts)
 
 
MENU options:
|- Choose connection type
|- Server WWW
|- Bluetooth 
|- Choose USB
———————————————————————-
|- Change URL to Server
|- Reload
———————————————————————-
|- BT Connection type
|—|- Secure connection
|—|- Insecure connection
|—|- Secure and Insecure connection
|—|- Make discoverable
|—|- Pairing devices
———————————————————————-
|- USB: Choose Storage
———————————————————————-
|- Close app
 
 
FAQ:
1. Which is the best type of connection:
O: According to me the type of server connection or USB. In these types, you can view the scripts javascript and images. The Bluetooth only static text.
2. Will there be an application server for the server type?
O: Perhaps, but only for Linux.
3. Can I somehow develop the project?
O: Of course, if you see errors that you are able to fix it, or developed a project with some significant features, you can download the project from github to your computer, work on your copy and send the best results for me on github. New connection requests for files in the project will appear in the Pull Requests. See if new changes are worthwhile.