- •Introduction
- •External apIs
- •Connecting to public apIs
- •Interacting with soap services
- •2 Creating a mobile application for os Android
- •2.1 Eclipse
- •2.2 Web Server
- •2.3 Php and json
- •2.4 Java
- •2.5.1 The use case diagram
- •2.5.2 The sequence diagram
- •3 Implementation of the project
- •3.1 Architecture of application
- •3.2 Description of the classes
- •3.2.1 MainActivity.Java
- •3.2.2 Register.Java
- •3.2.3 Login.Java
- •3.2.2.1 Description of the functions and variables of the class Register.Java
- •3.2.5 Call.Java
- •3.3 Php scripts
- •3.4 Xml files
- •3.5 User's Guide to the application's
- •4. Economic Part
- •4.1 Economic efficiency
- •4.2 Android Market
- •4.3 Calculation of the costs of developing software
- •4.3.1 Calculation of the cost of materials
- •4.3.2 Expenditure on salaries
- •4.3.3 The costs of operation and maintenance of equipment
- •4.4 Calculation of profit
- •5 Health and life safety
- •5.2 Analysis of dangerous and harmful factors
- •5.3 Production sanitation and health
- •5.4 Electrical safety
- •5.5 Fire safety
- •5.6 Safety precautions when working with a computer
- •5.7 Calculation of artificial light and noise workplace laboratories "nit"
3.3 Php scripts
In application php scripts are used for processing information with JSON for storing dates in the database. All the scripts are used to connect to database. In Table 7 written detailed description of php scripts. In figure 10 written example of one php script.
Table 7 - Description of php scripts
Name |
description |
Save.php |
Processes data and stores the contacts database |
Sav.php |
Clears the database from old contacts |
Login.php |
Checks the data for authorization |
Backup.php |
Copies the information from the database and sends to the application to save to phone |
Register.php |
Enters to the database of the new member |
DB_connect.php |
Creates a database connection |
DB_config.php |
Database Settings |
<?php
$response = array();
// check for required fields
if (isset($_POST['login']) && isset($_POST['password'])) {
$login = $_POST['login'];
$password = $_POST['password'];
// include db connect class
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
$men = mysql_query("SELECT * FROM users where login = '$login'");
if(mysql_num_rows($men) > 0){
$response["success"] = 2;
$response["message"] = "login zanyat.";
// echoing JSON response
echo json_encode($response);
}else{
// mysql inserting a new row
$result = mysql_query("INSERT INTO users(login, password) VALUES('$login', '$password')");
// check if row inserted or not
if ($result) {
// successfully inserted into database
$response["login"] = $login;
$response["success"] = 1;
$response["message"] = "Product successfully created.";
// echoing JSON response
echo json_encode($response);
} else {
// failed to insert row
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
// echoing JSON response
echo json_encode($response);
}
}
}
?>
Figure 10 - Register.php
3.4 Xml files
Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. In diploma project xml used for designing application. XML is view of application for user. In table 8 xml’s used in diploma project. In figure 11 example of xml file.
Table 8 - XML descriptions.
Name |
description |
activity_main.xml |
For designing main page |
backup.xml |
For designing backup page |
call.xml |
For designing call page |
login.xml |
For designing login page |
register.xml |
For designing register page |
simple.xml |
For creating list |
success.xml |
For designing logged in page |
styles.xml |
Design colors and font |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="login" />
<EditText
android:id="@+id/eLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="password" />
<EditText
android:id="@+id/ePass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
<TextView
android:id="@+id/eError"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/bLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login" />
</LinearLayout>
Figure 11 - Login.XML