Xamarin.Android - Build Real-life Application Using TCP/IP - Part One

The purpose of this project is to develop an Android-based application which will serve the administrator with on-demand remote surveillance and controlling of workstations of a workplace. The project will involve the development of two applications, one will run on workstations and the other one will run on the mobile phone of the Administrator. Both of these applications will be connected through Wi-Fi.

Tshe misuse of official workstations is a common practice among the users of many work environments where proper monitoring mechanism do not exist. It results in the waste of resources and in not meeting the overall objectives of an organization. So, to achieve the maximum and desired results in a work environment, an effective mechanism through which the Administrator can monitor and control the workstations under the use of employees is needed.

Purpose

The purpose of this project is to develop an Android-based application which will serve the administrator with on-demand remote surveillance and controlling of workstations of the workplace. The project will involve the development of two applications, one will run on workstations and the other one will run on the mobile phone of the administrator. Both the applications will be connected through Wi-Fi. The implementation of such a mechanism will allow the administrator, to not only have an eye on the activities of users but also, will make him/her able to remotely control the specific workstation(s).

Scope of Project

There will be two applications in this project,

Server ApplicationServer Application will continuously run on each workstation in workplace. The server application will be connected with the Client Application through a Wi-Fi connection. It will take a screenshot of user activity on the demand of the administrator and will transfer the same to Client/mobile application. This application will interpret and execute commands received from the Client/mobile application.

Client / Android ApplicationAndroid application will run on Administrator’s smart mobile phone and will provide an effective interface through which the Administrator will be able to connect it with the Server Application. Through this application, the Administrator will be able to instruct the Server Application to take the screenshot(s) and send to this application. Through this application, the Administrator will also be able to control any workstation and perform the activities such as sending a message, turning the workstation into sleep mode and shutting down any workstation etc.

Sign in and User RegistrationClient / mobile Application will provide User Registration interface through which the user will register as Admin. The application will provide a proper interface for Sign in through which Admin will log in to the application by entering the username and password.

Screenshot taking and sending to Client / Mobile ApplicationServer Application will take the screenshot(s) of user activity on any workstation on demand of the Administrator through Client/mobile Application. Screenshot(s) will be transferred to the client/mobile application.

Controlling Work StationsThe administrator will be able to control any workstation through sending commands. Administrator will be able to perform sending a message to the workstation turning that into sleep mode, locking the workstation, and shutting down the workstation

LogoutAdministrator will be able to terminate the connection between the client/mobile application and Server application by logging out from the application.

Client Application

In the requirements, the first task is to provide the functionality of login and registration for the client. Therefore, first, I will develop a login and registration module in Xamarin.Android.

The steps given below are required to be followed in order to create a SQLite operations app in Xamarin.Android, using Visual Studio.

Step 1 - Create a Project

Open Visual Studio and go to New Project-> Templates-> Visual C#-> Android-> Blank app. give it a name, like Client.

Step 2 - Writing Admin Class

Before you go further, you need to write your Admin class with all the getter and setter methods to maintain a single admin as an object. Also, write two constructors in the admin class. Go to Solution Explorer-> Project Name and right-click. Select Add -> New Item-> Class. Give it a name as Admin.cs and write the following code.

public Admin(string Password) //Constructor with one parameter for password verifing

{

this.Password = Password;

}

}

Step 3 - Writing SQLite Helper Class

We need to write our own helper class to create a new database with operations. Go to Solution Explorer-> Project Name and right-click. Select Add -> New Item-> Class. Give it a name as Helper.cs. Inherit with SQLiteOpenHelper class and write the following code with appropriate namespaces.

Next, add a new layout by going to Solution Explorer-> Project Name-> Resources-> Layout. Right-click to add a new item, select Layout, and give it a name, such as SignUp.axml. Open this layout file and add the following code.

Add a new Activity. For this, open Solution Explorer-> Project Name-> right click to add a new item and select Activity. Give it a name like SignUp.cs and add the following code using the appropriate namespaces.

This was the process of creating an app for Login and Registration with SQLite database in Xamarin.Android.

We have completed our first module of the client that was login and registration. For simplicity, I am splitting the article into three parts. In the next part, I will start building the connection with server and client. So, please stay tuned for my next article of this series.