Free Essay

Android Based Webstatic Server

In:

Submitted By saiprakash
Words 9090
Pages 37
A Project Report
On
ANDROID BASED STATIC WEBSERVER
BY

CONTENTS
TITLE
ABSTRACT INTRODUCTION…………………………………………………. 1
Purpose……………………………………………………..………… 1.1
Scope…………………………………………………..…….……….. 1.2
Definitions, Acroynms, Abbrivations……………………. 1.3
Overview……………………..………………………………………. 1.4
SYSTEM ANALYSIS……………………………………… 3
Software Requirements Specification…..………………. 3.1
Hardware Requirements……………………………………….. 3.1.1
Software Requirements………………………………………… 3.1.2
IMPLEMENTATION……………………………………… 4
Modules……………………………………………………………….. 4.1
Accounts…………………………………………………………..4.1.1
Transactions………………………………………………………….. 4.1.2
DESIGN………………..…………………………….……… 5
UML Diagrams………………………………………………………… 5.1
Class Diagram………………………………………………………… 5.1.1
Usecase Diagram….……………………………………………….. 5.1.2
Sequence Diagram….……………………………………………….. 5.1.3

RESULT FOR IMPLEMENTATION…………………… 6
Output Screens………………………………………………………. 6.1
SYSTEM TESTING………………………………………….7
Types of Testing………………………………………………………. 7.1
TESTCASES…………………………………………………..8
CONCLUSION………………………………………………..9

ANDROID BASED STATIC WEBSERVER
ABSTRACT
Android is software platform and operating system for mobile devices. Being an open-source, it is based on the Linux kernel. It was developed by Google and later the Open Handset Alliance (OHA). It allows writing managed code in the Java language. Due to Android here is the possibility to write applications in other languages and compiling it to ARM native code.
This project is a mobile-based web server for serving static
HTML/JavaScript pages to the client systems (the systems could be PCs or Mobiles) for access by these client systems. A static website will be designed to serve from the mobile(web server). The Mobile Web server is based on Android OS. The static website saved inside the SD Card of the Android Mobile would be the source for the web server, thereby increasing the capability of the Mobile to become a web server for even PCs in the Network created by Android Mobile itself.
Modules :
1).The HTML Web pages Module : This module is for designing the static html Pages that are to be served by the Android Mobile to other Android Mobiles or even PCs in its Network.

2).The Jquery dynamic client content Module : This Module is to display the dynamic client content in the browsers of client mobiles or client PCs.

3). Server Module : This module is required for multi-threading the webpages to various clients connected to this module by synchronizing the data for each client and by starting the socket connection between the server and a given client.

4). ServerHandler : This module mediates between the Server and Clients by calling the connection from the server to accept the requests from the clients.

EXISTING SYSTEM:
The existing system doesn't provide a web server with a facility to access a website within both wired and wireless networks from an Android Mobile

PROPOSED SYSTEM:
The proposed system will achieve the above features on the Android Mobile.

Software Requirements:
Front End: Java, JDK, Eclipse, Android SDK, KWS software tool
Web Browser: Mozilla Firefox or any browser
OS: Windows XP or any latest versions of windows
Hardware Requirements:
PC
PC with Pentium IV,
RAM 512 MB (Minimum)
HDD- 40 GB (Minimum)
Mobile
Android Mobile

CHAPTER: 1 INTRODUCTION

1.1 Purpose: The purpose of this project is to develop a static web server that runs on an android mobile and from this web server , the files uploaded by the mobile user into his android mobile, are made available to all the PCs or Laptops within the network in which the mobile is connected . 1.2 Scope :
The scope of this project is limited to serving static web pages with a facility to download the content like PDFs,PPTs, or videos from the mobile within an existing Wi-Fi network .

1.3 Definitions, Acronyms, Abbreviations :

Wi-Fi : Wireless Fidelity Static Web Server: This is a server that serves static HTML/JQuery/ Java script web pages.

1.4 Overview:
This projects is based on developing a static web server for an android mobile using Android SDK for serving static web content like HTML , java script or JQuery pages. The development of web server involves creating threads for running server and clients . The exchange of web content from server to client and the connectivity of the clients is managed by sockets created using Socket programming concepts and multi-threading concepts in JAVA .The front-end UI screens are developed using Android XML and JAVA files for the Android SDK environment are created for implementing the business logic. The project design is based on a two-tier architecture. The UI and Business Logic are implement using Android SDK programming concepts.

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

------------------------------------------------- SYSTEM ANALYSIS

EXISTING SYSTEM:
The existing system has web servers that are confined to only wireless devices like Laptops , Tabs or Mobiles.
DISADVANTAGE:
* A Wireless LAN Adapter is required in all devices that need to access the web server * Legacy systems like PCs cannot access the files for the web server as there is no provision for Wi-Fi in these systems * The web servers are limited to only smart devices

PROPOSED SYSTEM:
Mobile Devices are one of best way to reduce the cost and increase the effectiveness of applications. The web server proposed here works on wi-fi networks and therefore can be easily connected/extended to any system working in the LAN(wired/wireless) to access the web pages from the mobile.

ADVANTAGE: * Access to all systems within the network * Even legacy systems can access the web server * Android mobiles are easy to host or show the web content in any device with a web server designed like this which is based on wi-fi connectivity.

------------------------------------------------- 3.Technologies

Development Environment
IDE – Eclipse
Eclipse plug-in - ADT
Software Development Kit (SDK)
Android Emulator
Debugger

Setup Android SDK Download Android SDK and extract the zip file to an arbitrary folder http://androidappdocs.appspot.com/sdk/index.html E.g.: extract to C:\
The SDK will be used by ADT in eclipse

Setup ADT plugin Configure ADT Plugin Open eclipse Window->Preferences, select Android
Setup the SDK location as the folder where you extracted the downloaded SDK zip file

Setup SDK APIs Open Window->Android SDK and AVD Manager
Click Available Packages and then choose proper APIs to install, the latest may be the best

Setup Emulators

Ready…

src: source folder gen: SDK generated file android 2.2: reference lib assets: binary resources res: resource files and resource description files
AndroidManifest.xml: application description file default.properties: project properties file

modify HelloWorld.java

Run Hello World
Select HelloWorld Project, Run->Run as->Android Application
ADT will start a proper AVD and run HelloWorld app on it

Behind HelloWorld #1

R.java, generated by Android SDK, represents all the resources of the app. resources are all in res folder resources are pre-compiled into binary format

R.java, generated by Android SDK, represents all the resources of the app. resources are all in res folder resources are pre-compiled into binary format

/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package sample.hello; public final class R { public static final class attr { } public static final class drawable { public static final int icon=0x7f020000; } public static final class layout { public static final int main=0x7f030000; } public static final class string { public static final int app_name=0x7f040001; public static final int hello=0x7f040000;

Linear Layout
37
res/layout , contains layout declarations of the app, in XML format, UIs are built according to the layout file main.xml <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=http://schemas.android.com/apk/res/android android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" />
</LinearLayout>

A reference to String resource ‘hello’ Behind HelloWorld #3 res/values, contains string declarations or other values(e.g.:colors) of the app string.xml, contains string resources <?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloWorld!</string> <string name="app_name">HelloWorld</string>
</resources>

referenced in res/layout/main.xml referenced in AndroidManifest.xml

Behind HelloWorld #4 res/drawable, contains all image resources folders may have suffixes, app will choose the most suitable one, so do the other resources three folders: drawable-ldpi, drawable-hdpi, drawable-mdpi, each contains an icon.png file app will choose the proper icon according to the device DPI reference name:@drawable/icon other folders we may use in future menu, anim (animation), xml ( preference and searchable)

Behind HelloWorld #5 AndroidManifest.xml describe the application declare app’s name, version, icon, permission, etc… declare the application's components: activity, service ,receiver or provider

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="sample.hello" android:versionCode="1" android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HelloWorld" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER”/> </intent-filter> </activity>
</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>

Core Components-Activity #1 Basically, An activity presents a visual user interface for one focused endeavor the user can undertake
An application might consist of just one activity or several, each Activity is derived from android.app.Activity and should be declared in AndroidManifest.xml file
Each activity is given a default window to draw in, the window may be full screen or smaller and on top of other window
The visual content of the window is provided by a hierarchy of views — objects derived from the base View class
Activity.setContentView() method is used to set a certain hierarchy of view objects

Core Components-Activity #2
Activities are activated by asynchronous messages called intents
An intent is an Intent object that holds the content of the message
The action being requested or the URI of the data to act on
The <intent-filter> label in AndroidManifest.xml file specifies the Intent that can start the Activity

declares the main activity, it will be started automatically when the app starts
An activity is launched (or given something new to do) by passing an Intent object to Context.startActivity() or Activity.startActivityForResult()

Other Core Components Service
A service doesn't have a visual user interface, runs in the background for a period of time
Broadcast receivers a component that does nothing but receive and react to broadcast announcements
Content providers
A content provider makes a specific set of the application's data available to other applications.
The data can be stored in the file system, in an SQLite database, or in any other manner that makes sense Beyond HelloWorld #1 Build up an app that you can input your greetings and display your greetings
Input: EditText
Display: TextView
Of course, we have to add an button
Edit res/layout/main.xml file to add these components each has an android:id property, used to reference it in code

Beyond HelloWorld #2 Beyond HelloWorld #3

-------------------------------------------------
3. SYSTEM STUDY

3.1 FEASIBILITY STUDY The feasibility of the project is analyzed in this phase and business proposal is put forth with a very general plan for the project and some cost estimates. During system analysis the feasibility study of the proposed system is to be carried out. This is to ensure that the proposed system is not a burden to the company. For feasibility analysis, some understanding of the major requirements for the system is essential.

Three key considerations involved in the feasibility analysis are * ECONOMICAL FEASIBILITY * TECHNICAL FEASIBILITY * SOCIAL FEASIBILITY

3.2 ECONOMICAL FEASIBILITY: This study is carried out to check the economic impact that the system will have on the organization. The amount of fund that the company can pour into the research and development of the system is limited. The expenditures must be justified. Thus the developed system as well within the budget and this was achieved because most of the technologies used are freely available. Only the customized products had to be purchased. In this product there is no cost involved in developing the required functionalities.

3.3 TECHNICAL FEASIBILITY: This study is carried out to check the technical feasibility, that is, the technical requirements of the system. Any system developed must not have a high demand on the available technical resources. This will lead to high demands on the available technical resources. This will lead to high demands being placed on the client. The developed system must have a modest requirement, as only minimal or null changes are required for implementing this system. This product requies a modest increment of adding a wi-fi device to the existing network.
3.4 SOCIAL FEASIBILITY The aspect of study is to check the level of acceptance of the system by the user. This includes the process of training the user to use the system efficiently. The user must not feel threatened by the system, instead must accept it as a necessity. The level of acceptance by the users solely depends on the methods that are employed to educate the user about the system and to make him familiar with it. This product requires minimum knowledge of connecting to a wi-fi network and starting the web server with a port number assigned to it. Usage of browser to access a server is also required.

-------------------------------------------------
4.Software Environment
Android is a Linux-based operating system for mobile devices such as smartphones and tablet computers. It is developed by the Open Handset Alliance led by Google . Android has a large community of developers writing applications ("apps") that extend the functionality of the devices. Developers write primarily in a customized version of Java.
4.1 Android architecture
Android consists of a kernel based on the Linux kernel, with middleware, libraries and APIs written in C and application software running on an application framework which includes Java-compatible libraries based on Apache Harmony. Android uses the Dalvik virtual machine with just-in-time compilation to run Dalvik dex-code (Dalvik Executable), which is usually translated from Java bytecode.

The main hardware platform for Android is the ARM architecture. There is support for x86 from the Android x86 project, and Google TV uses a special x86 version of Android.

Fig 4.1 Applications and Widgets

Android's kernel is based on the Linux kernel and has further architecture changes by Google outside the typical Linux kernel development cycle. Android does not have a native X Window System nor does it support the full set of standard GNU libraries, and this makes it difficult to port existing Linux applications or libraries to Android.

Certain features that Google contributed back to the Linux kernel, notably a power management feature called wakelocks, were rejected by mainline kernel developers, partly because kernel maintainers felt that Google did not show any intent to maintain their own code. Even though Google announced in April 2010 that they would hire two employees to work with the Linux kernel community, Greg Kroah-Hartman, the current Linux kernel maintainer for the -stable branch, said in December 2010 that he was concerned that Google was no longer trying to get their code changes included in mainstream Linux. Some Google Android developers hinted that "the Android team was getting fed up with the process", because they were a small team and had more urgent work to do on Android.

However, in September 2010, Linux kernel developer Rafael J. Wysocki added a patch that improved the mainline Linux wakeup events framework. He said that Android device drivers that use wake locks can now be easily merged into mainline Linux, but that Android's opportunistic suspend features should not be included in the mainline kernel. In 2011 Linus Torvalds said that "eventually Android and Linux would come back to a common kernel, but it will probably not be for four to five years".

In December 2011, Greg Kroah-Hartman announced the start of the Android Mainlining Project, which aims to put some Android drivers, patches and features back into the Linux kernel, starting in Linux 3.3. further integration being expected for Linux Kernel 3.4.

4.2 Application Framework
By providing an open development platform, Android offers developers the ability to build extremely rich and innovative applications. Developers are free to take advantage of the device hardware, access location information, run background services, set alarms, add notifications to the status bar, and much, much more.
Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user.
Underlying all applications is a set of services and systems, including: * A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser * Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data * A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files * A Notification Manager that enables all applications to display custom alerts in the status bar * An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack

Libraries
Android includes a set of C/C++ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application framework. Some of the core libraries are listed below: * System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices * Media Libraries - based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG * Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications * LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view * SGL - the underlying 2D graphics engine * 3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer * FreeType - bitmap and vector font rendering * SQLite - a powerful and lightweight relational database engine available to all applications

Android Runtime

Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language.

Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included "dx" tool.
The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.

Linux Kernel

Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.

Android SDK

You should update to the latest tools or platform using the Android SDK and AVD Manager, rather than downloading a new SDK starter package.

http://dl.google.com/android/android-sdk_r16-macosx.zip

Here's an overview of the steps you must follow to set up the Android SDK: * Prepare your development computer and ensure it meets the system requirements. * Install the SDK starter package from the table above. (If you're on Windows, download the installer for help with the initial setup.) * Install the ADT Plugin for Eclipse (if you'll be developing in Eclipse). * Add Android platforms and other components to your SDK. * Explore the contents of the Android SDK (optional).

4.3 System Requirements

Supported Operating Systems * Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit) * Mac OS X 10.5.8 or later (x86 only) * Linux (tested on Ubuntu Linux, Lucid Lynx) * GNU C Library (glibc) 2.7 or later is required. * On Ubuntu Linux, version 8.04 or later is required. * 64-bit distributions must be capable of running 32-bit applications. For information about how to add support for 32-bit applications

Supported Development Environments for Android SDK

Eclipse IDE * Eclipse 3.6 (Helios) or greater
Note: Eclipse 3.5 (Galileo) is no longer supported with the latest version of ADT. * Eclipse JDT plugin (included in most Eclipse IDE packages) * If you need to install or update Eclipse, you can download it from http://www.eclipse.org/downloads/.
Several types of Eclipse packages are available for each platform. For developing Android applications, we recommend that you install one of these packages: * Eclipse IDE for Java Developers * Eclipse Classic * Eclipse IDE for Java EE Developers * JDK 5 or JDK 6 (JRE alone is not sufficient) * Android Development Tools plugin (recommended)
Other development environments or IDEs * JDK 5 or JDK 6 (JRE alone is not sufficient) * Apache Ant 1.8 or later * Not compatible with Gnu Compiler for Java (gcj)

Hardware requirements for Android SDK
The Android SDK requires disk storage for all of the components that you choose to install. The table below provides a rough idea of the disk-space requirements to expect, based on the components that you plan to use.

Component type | Approximate size | Comments | SDK Tools | 35 MB | Required. | SDK Platform-tools | 6 MB | Required. | Android platform (each) | 150 MB | At least one platform is required. | SDK Add-on (each) | 100 MB | Optional. | USB Driver for Windows | 10 MB | Optional. For Windows only. | Samples (per platform) | 10M | Optional. | Offline documentation | 250 MB | Optional. |

Note that the disk-space requirements above are in addition to those of the Eclipse IDE, JDK, or other prerequisite tools that you may need to install on your development computer.

Installing the SDK

Step 1. Preparing Your Development Computer
Before getting started with the Android SDK, take a moment to confirm that your development computer meets the System Requirements. In particular, you might need to install the JDK, if you don't have it already.

If you will be developing in Eclipse with the Android Development Tools (ADT) Plugin—the recommended path if you are new to Android—make sure that you have a suitable version of Eclipse installed on your computer as described in the System Requirements document.

If you need to install Eclipse, you can download it from this location: http://www.eclipse.org/downloads/ The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

Step 2. Downloading the SDK Starter Package
The SDK starter package is not a full development environment—it includes only the core SDK Tools, which you can use to download the rest of the SDK components (such as the latest Android platform).

If you haven't already, get the latest version of the SDK starter package from the SDK download page.

If you downloaded a .zip or .tgz package (instead of the SDK installer), unpack it to a safe location on your machine. By default, the SDK files are unpacked into a directory named android-sdk-<machine-platform>.

If you downloaded the Windows installer (.exe file), run it now and it will check whether the proper Java SE Development Kit (JDK) is installed (installing it, if necessary), then install the SDK Tools into a default location (which you can modify).

Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later, when setting up the ADT plugin and when using the SDK tools from the command line.

Step 3. Installing the ADT Plugin for Eclipse

Android offers a custom plugin for the Eclipse IDE, called Android Development Tools (ADT), that is designed to give you a powerful, integrated environment in which to build Android applications. It extends the capabilites of Eclipse to let you quickly set up new Android projects, create an application UI, debug your applications using the Android SDK tools, and even export signed (or unsigned) APKs in order to distribute your application. In general, developing in Eclipse with ADT is a highly recommended approach and is the fastest way to get started with Android.

If you'd like to use ADT for developing Android applications, install it now. Read Installing the ADT Plugin for step-by-step installation instructions, then return here to continue the last step in setting up your Android SDK.

If you prefer to work in a different IDE, you do not need to install Eclipse or ADT. Instead, you can directly use the SDK tools to build and debug your application. The Introduction to Android application development outlines the major steps that you need to complete when developing in Eclipse or other IDEs.

Step 4. Adding Platforms and Other Components
The last step in setting up your SDK is using the Android SDK and AVD Manager (a tool included in the SDK starter package) to download essential SDK components into your development environment.
The SDK uses a modular structure that separates the major parts of the SDK—Android platform versions, add-ons, tools, samples, and documentation—into a set of separately installable components. The SDK starter package, which you've already downloaded, includes only a single component: the latest version of the SDK Tools. To develop an Android application, you also need to download at least one Android platform and the associated platform tools. You can add other components and platforms as well, which is highly recommended.
If you used the Windows installer, when you complete the installation wizard, it will launch the Android SDK and AVD Manager with a default set of platforms and other components selected for you to install. Simply click Install to accept the recommended set of components and install them. You can then skip to Step 5, but we recommend you first read the section about the Available Components to better understand the components available from the Android SDK and AVD Manager.

You can launch the Android SDK and AVD Manager in one of the following ways: * From within Eclipse, select Window > Android SDK and AVD Manager. * On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory. * On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute android

To download components, use the graphical UI of the Android SDK and AVD Manager to browse the SDK repository and select new or updated components (see figure 1). The Android SDK and AVD Manager installs the selected components in your SDK environment. For information about which components you should download, see Recommended Components.

Figure 4.3 The Android SDK and AVD Manager's Available Packages panel, which shows the SDK components that are available for you to download into your environment.

Available Components
By default, there are two repositories of components for your SDK: Android Repository and Third party Add-ons.

The Android Repository offers these types of components: * SDK Tools — Contains tools for debugging and testing your application and other utility tools. These tools are installed with the Android SDK starter package and receive periodic updates. You can access these tools in the <sdk>/tools/ directory of your SDK. To learn more about them, see SDK Tools in the developer guide. * SDK Platform-tools — Contains platform-dependent tools for developing and debugging your application. These tools support the latest features of the Android platform and are typically updated only when a new platform becomes available. You can access these tools in the <sdk>/platform-tools/ directory. To learn more about them, see Platform Tools in the developer guide.

* Android platforms — An SDK platform is available for every production Android platform deployable to Android-powered devices. Each SDK platform component includes a fully compliant Android library, system image, sample code, and emulator skins. To learn more about a specific platform, see the list of platforms that appears under the section "Downloadable SDK Components" on the left part of this page. * USB Driver for Windows (Windows only) — Contains driver files that you can install on your Windows computer, so that you can run and debug your applications on an actual device. You do not need the USB driver unless you plan to debug your application on an actual Android-powered device. If you develop on Mac OS X or Linux, you do not need a special driver to debug your application on an Android-powered device. See Using Hardware Devices for more information about developing on a real device. * Samples — Contains the sample code and apps available for each Android development platform. If you are just getting started with Android development, make sure to download the samples to your SDK. * Documentation — Contains a local copy of the latest multiversion documentation for the Android framework API.
The Third party Add-ons provide components that allow you to create a development environment using a specific Android external library (such as the Google Maps library) or a customized (but fully compliant) Android system image. You can add additional Add-on repositories by clicking Add Add-on Site.
Recommended Components
The SDK repository contains a range of components that you can download. Use the table below to determine which components you need, based on whether you want to set up a basic, recommended, or full development environment:

Environment | SDK Component | Comments | Basic | SDK Tools | If you've just installed the SDK starter package, then you already have the latest version of this component. The SDK Tools component is required to develop an Android application. Make sure you keep this up to date. | | SDK Platform-tools | This includes more tools that are required for application development. These tools are platform-dependent and typically update only when a new SDK platform is made available, in order to support new features in the platform. These tools are always backward compatible with older platforms, but you must be sure that you have the latest version of these tools when you install a new SDK platform. | | SDK platform | You need to download at least one platform into your environment, so that you will be able to compile your application and set up an Android Virtual Device (AVD) to run it on (in the emulator). To start with, just download the latest version of the platform. Later, if you plan to publish your application, you will want to download other platforms as well, so that you can test your application on the full range of Android platform versions that your application supports. | + | | Recommended
(plus Basic) | Documentation | The Documentation component is useful because it lets you work offline and also look up API reference information from inside Eclipse. | | Samples | The Samples components give you source code that you can use to learn about Android, load as a project and run, or reuse in your own app. Note that multiple samples components are available — one for each Android platform version. When you are choosing a samples component to download, select the one whose API Level matches the API Level of the Android platform that you plan to use. | | Usb Driver | The Usb Driver component is needed only if you are developing on Windows and have an Android-powered device on which you want to install your application for debugging and testing. For Mac OS X and Linux platforms, no special driver is needed. | + | | Full
(plus Recommended) | Google APIs | The Google APIs add-on gives your application access to the Maps external library, which makes it easy to display and manipulate Maps data in your application. | | Additional SDK Platforms | If you plan to publish your application, you will want to download additional platforms corresponding to the Android platform versions on which you want the application to run. The recommended approach is to compile your application against the lowest version you want to support, but test it against higher versions that you intend the application to run on. You can test your applications on different platforms by running in an Android Virtual Device (AVD) on the Android emulator. |
Once you've installed at least the basic configuration of SDK components, you're ready to start developing Android apps. The next section describes the contents of the Android SDK to familiarize you with the components you've just installed.
For more information about using the Android SDK and AVD Manager, see the Adding SDK Components document.

Step 5. Exploring the SDK (Optional)
Once you've installed the SDK and downloaded the platforms, documentation, and add-ons that you need, we suggest that you open the SDK directory and take a look at what's inside.
The table below describes the full SDK directory contents, with components installed. Name | Description | add-ons/ | Contains add-ons to the Android SDK development environment, which let you develop against external libraries that are available on some devices. | docs/ | A full set of documentation in HTML format, including the Developer's Guide, API Reference, and other information. To read the documentation, load the file offline.html in a web browser. | platform-tools/ | Contains platform-dependent development tools that may be updated with each platform release. The platform tools include the Android Debug Bridge (adb) as well as other tools that you don't typically use directly. These tools are separate from the development tools in the tools/ directory because these tools may be updated in order to support new features in the latest Android platform. | platforms/ | Contains a set of Android platform versions that you can develop applications against, each in a separate directory. | | <platform>/ | Platform version directory, for example "android-11". All platform version directories contain a similar set of files and subdirectory structure. Each platform directory also includes the Android library (android.jar) that is used to compile applications against the platform version. | samples/ | Sample code and apps that are specific to platform version. | tools/ | Contains the set of development and profiling tools that are platform-independent, such as the emulator, the Android SDK and AVD Manager, ddms, hierarchyviewer and more. The tools in this directory may be updated at any time using the Android SDK and AVD Manager and are independent of platform releases. | SDK Readme.txt | A file that explains how to perform the initial setup of your SDK, including how to launch the Android SDK and AVD Manager tool on all platforms. | SDK Manager.exe | Windows SDK only. A shortcut that launches the Android SDK and AVD Manager tool, which you use to add components to your SDK. |

Optionally, you might want to add the location of the SDK's tools/ and platform-tools to your PATH environment variable, to provide easy access to the tools.

4.4 Android's Features:
Handset layouts
The platform is adaptable to larger, VGA, 2D graphics library, 3D graphics library based on OpenGL ES 2.0 specifications, and traditional Smartphone layouts.
Storage:
SQLite, a lightweight relational database, is used for data storage purposes.

Connectivity
Android supports connectivity technologies including GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-Fi, LTE, NFC and WiMAX.
Messaging
SMS and MMS are available forms of messaging, including threaded text messaging and now Android Cloud To Device Messaging (C2DM) is also a part of Android Push Messaging service.
Multiple language support
Android supports multiple languages.
Web browser
The web browser available in Android is based on the open-source WebKit layout engine, coupled with Chrome's V8 JavaScript engine. The browser scores 100/100 on the Acid3 test on Android 4.0.
Java support
While most Android applications are written in Java, there is no Java Virtual Machine in the platform and Java byte code is not executed. Java classes are compiled into Dalvik executables and run on Dalvik, a specialized virtual machine designed specifically for Android and optimized for battery-powered mobile devices with limited memory and CPU. J2ME support can be provided via third-party applications.
Media support
Android supports the following audio/video/still media formats: WebM, H.263, H.264 (in 3GP or MP4 container), MPEG-4 SP, AMR, AMR-WB (in 3GP container), AAC, HE-AAC (in MP4 or 3GP container), MP3, MIDI, Ogg Vorbis, FLAC, WAV, JPEG, PNG, GIF, BMP.[71]
Streaming media support
RTP/RTSP streaming (3GPP PSS, ISMA), HTML progressive download (HTML5 <video> tag). Adobe Flash Streaming (RTMP) and HTTP Dynamic Streaming are supported by the Flash plugin. Apple HTTP Live Streaming is supported by RealPlayer for Android, and by the operating system in Android 3.0 (Honeycomb).
Additional hardware support
Android can use video/still cameras, touchscreens, GPS, accelerometers, gyroscopes, barometers, magnetometers, dedicated gaming controls, proximity and pressure sensors, thermometers, accelerated 2D bit blits (with hardware orientation, scaling, pixel format conversion) and accelerated 3D graphics.
Multi-touch
Android has native support for multi-touch which was initially made available in handsets such as the HTC Hero. The feature was originally disabled at the kernel level (possibly to avoid infringing Apple's patents on touch-screen technology at the time). Google has since released an update for the Nexus One and the Motorola Droid which enables multi-touch natively.
Bluetooth
Supports A2DP, AVRCP, sending files (OPP), accessing the phone book (PBAP), voice dialing and sending contacts between phones. Keyboard, mouse and joystick (HID) support is available in Android 3.1+, and in earlier versions through manufacturer customizations and third-party applications.
Video calling
Android does not support native video calling, but some handsets have a customized version of the operating system that supports it, either via the UMTS network (like the Samsung Galaxy S) or over IP. Video calling through Google Talk is available in Android 2.3.4 and later. Gingerbread allows Nexus S to place Internet calls with a SIP account. This allows for enhanced VoIP dialing to other SIP accounts and even phone numbers. Skype 2.1 offers video calling in Android 2.3, including front camera support.
Multitasking
Multitasking of applications is available.

Voice based features
Google search through voice has been available since initial release. Voice actions for calling, texting, navigation, etc. are supported on Android 2.2 onwards.
Tethering
Android supports tethering, which allows a phone to be used as a wireless/wired Wi-Fi hotspot. Before Android 2.2 this was supported by third-party applications or manufacturer customizations.
Screen capture
Android supports capturing a screenshot by pressing the power and volume-down buttons at the same time. Prior to Android 4.0, the only methods of capturing a screenshot were through manufacturer and third-party customizations or otherwise by using a PC connection (DDMS developer's tool). These alternative methods are still available with the latest Android.
External storage
Most Android devices include microSD slot and can read microSD cards formatted with FAT32, Ext3fs or Ext4fs file system. To allow use of high-capacity storage media such as USB flash drives and USB HDDs, many Android tablets also include USB 'A' receptacle. Storage formatted with FAT32 is handled by Linux Kernel VFAT driver, while 3rd party solutions are required to handle other popular file systems such as NTFS, HFS Plus and exFAT.

Version history Android has seen a number of updates since its original release, each fixing bugs and adding new features. Each version is named, in alphabetical order, after a dessert. * 2.3 Gingerbread refined the user interface, improved the soft keyboard and copy/paste features, improved gaming performance, added SIP support (VoIP calls), and added support for Near Field Communication.

* 3.0 Honeycomb was a tablet-oriented release which supports larger screen devices and introduces many new user interface features, support for multi-core processors, hardware acceleration for graphics and full system encryption. The first device featuring this version, the Motorola Xoom tablet, went on sale in February 2011.

* 3.1 Honeycomb, released in May 2011, added support for extra input devices, USB host mode for transferring information directly from cameras and other devices, and the Google Movies and Books apps.

* 3.2 Honeycomb, released in July 2011, added optimization for a broader range of screen sizes, new "zoom-to-fill" screen compatibility mode, loading media files directly from SD card, and an extended screen support API. Huawei MediaPad is the first 7 inch tablet to use this version.

* 4.0 Ice Cream Sandwich, announced on October 19, 2011, brought Honeycomb features to smartphones and added new features including facial recognition unlock, network data usage monitoring and control, unified social networking contacts, photography enhancements, offline email searching, app folders, and information sharing using NFC. Android 4.0.3 Ice Cream Sandwich is the latest Android version that is available to phones. The source code of Android 4.0.1 was released on November 14, 2011.

------------------------------------------------- 5.SYSTEM DESIGN 5.1 INTRODUCTION Systems design is the process or art of defining the architecture, components, modules, interfaces, and data for a system to satisfy specified requirements. One could see it as the application of systems theory to product development. There is some overlap and synergy with the disciplines of systems analysis, systems architecture and systems engineering. 5.2 UML DIAGRAMS
Unified Modeling Language:

The Unified Modeling Language allows the software engineer to express an analysis model using the modeling notation that is governed by a set of syntactic semantic and pragmatic rules.
A UML system is represented using five different views that describe the system from distinctly different perspective. Each view is defined by a set of diagram, which is as follows. * User Model View * This view represents the system from the users perspective. * The analysis representation describes a usage scenario from the end-users perspective.

* Structural model view * In this model the data and functionality are arrived from inside the system. * This model view models the static structures.

* Behavioral Model View
It represents the dynamic of behavioral as parts of the system, depicting the interactions of collection between various structural elements described in the user model and structural model view.

* Implementation Model View In this the structural and behavioral as parts of the system are represented as they are to be built.

* Environmental Model View In this the structural and behavioral aspects of the environment in which the system is to be implemented are represented.

UML is specifically constructed through two different domains they are: * UML Analysis modeling, this focuses on the user model and structural model views of the system. * UML design modeling, which focuses on the behavioral modeling, implementation modeling and environmental model views.

Use case Diagrams represent the functionality of the system from a user’s point of view. Use cases are used during requirements elicitation and analysis to represent the functionality of the system. Use cases focus on the behavior of the system from external point of view.

Actors are external entities that interact with the system. Examples of actors include users like administrator, bank customer …etc., or another system like central database.

CLASS DIAGRAM:

USECASE DIAGRAM:

SEQUENCE DIAGRAM:

ACTIVITY DIAGRAM:

COLLABORATION DIAGRAM

DEPLOYMENT DIAGRAM:

------------------------------------------------- -------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------
Literature Survey

Literature survey is the most important step in software development process. Before developing the tool it is necessary to determine the time factor, economy n company strength. Once these things r satisfied, ten next steps is to determine which operating system and language can be used for developing the tool. Once the programmers start building the tool the programmers need lot of external support. This support can be obtained from senior programmers, from book or from websites. Before building the system the above consideration r taken into account for developing the proposed system.
By providing an open development platform, Android offers developers the ability to build extremely rich and innovative applications. Developers are free to take advantage of the device hardware, access location information, run background services, set alarms, add notifications to the status bar, and much, much more.
Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user.
Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language.

The Android operating system’s support for multi-tasking enables a wide range of mobile security functionality to run in the background, including virus scanning and automated backups. Android operating system allows for broader multitasking than that other popular smartphone OS, Android devices are able to support a wide range of mobile security functionality that runs in the background on an ongoing basis, such as automated backups and virus scanning. And with the arrival of 2.3.3, Android devices now offer several unlock options, including a numeric PIN, a password or a graphical pattern. Lock can protect your privacy. (App) Lock is a great application for those that would like to protect their privacy. You can choose which apps to protect and which ones not to along with being able to choose between password lock and pattern lock.

SAMPLE CODE OF THE PROJECT
Server.java :

package com.example.webserver;

import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.LinkedList;

import android.os.Bundle; import android.os.Handler; import android.os.Message;

public class Server extends Thread { private ServerSocket listener = null; private static Handler mHandler; private boolean running = true; public static LinkedList<Socket> clientList = new LinkedList<Socket>(); public Server(String ip, int port, Handler handler) throws IOException { super(); mHandler = handler; InetAddress ipadr = InetAddress.getByName(ip); listener = new ServerSocket(port,0,ipadr); } private static void send(String s) { Message msg = new Message(); Bundle b = new Bundle(); b.putString("msg", s); msg.setData(b); mHandler.sendMessage(msg); } @Override public void run() { while( running ) { try { send("Waiting for connections."); Socket client = listener.accept(); send("New connection from " + client.getInetAddress().toString()); new ServerHandler(client).start(); clientList.add(client); } catch (IOException e) { send(e.getMessage()); } } }

public void stopServer() { running = false; try { listener.close(); } catch (IOException e) { send(e.getMessage()); } } public synchronized static void remove(Socket s) { send("Closing connection: " + s.getInetAddress().toString()); clientList.remove(s); }
}

Main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" >
<TextView
android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" />

<LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="wrap_content">
<EditText android:text="8080" android:id="@+id/port" android:layout_width="wrap_content" android:layout_height="wrap_content"></EditText>
<ToggleButton android:text="ToggleButton01" android:id="@+id/toggle" android:layout_width="fill_parent" android:layout_height="wrap_content"></ToggleButton>

</LinearLayout>

<ScrollView android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:text="Log" android:id="@+id/log" android:layout_width="fill_parent" android:layout_height="fill_parent"></TextView>
</ScrollView>
</LinearLayout>

SCREEN SHOTS

Android Webserver in OFF state

7.1 INTRODUCTION TO TESTING
7.1 Introduction to Testing:
Testing is a process, which reveals errors in the program. It is the major quality measure employed during software development. During software development. During testing, the program is executed with a set of test cases and the output of the program for the test cases is evaluated to determine if the program is performing as it is expected to perform.
7.2 TESTING IN STRATEGIES: In order to make sure that the system does not have errors, the different levels of testing strategies that are applied at differing phases of software development are:
Unit Testing:
Unit Testing is done on individual modules as they are completed and become executable. It is confined only to the designer's requirements.
Each module can be tested using the following two Strategies: Black Box Testing:
In this strategy some test cases are generated as input conditions that fully execute all functional requirements for the program. This testing has been uses to find errors in the following categories: * Incorrect or missing functions * Interface errors * Errors in data structure or external database access * Performance errors * Initialization and termination errors.
In this testing only the output is checked for correctness.
The logical flow of the data is not checked.
White Box Testing :
In this the test cases are generated on the logic of each module by drawing flow graphs of that module and logical decisions are tested on all the cases. It has been uses to generate the test cases in the following cases: * Guarantee that all independent paths have been Executed. * Execute all logical decisions on their true and false Sides. * Execute all loops at their boundaries and within their operational bounds * Execute internal data structures to ensure their validity.

Integrating Testing :
Integration testing ensures that software and subsystems work together a whole. It tests the interface of all the modules to make sure that the modules behave properly when integrated together.
System Testing:
Involves in-house testing of the entire system before delivery to the user. It's aim is to satisfy the user the system meets all requirements of the client's specifications.
Acceptance Testing : It is a pre-delivery testing in which entire system is tested at client's site on real world data to find errors.

Test Approach : Testing can be done in two ways: * Bottom up approach * Top down approach Bottom up Approach:
Testing can be performed starting from smallest and lowest level modules and proceeding one at a time. For each module in bottom up testing a short program executes the module and provides the needed data so that the module is asked to perform the way it will when embedded with in the larger system. When bottom level modules are tested attention turns to those on the next level that use the lower level ones they are tested individually and then linked with the previously examined lower level modules.

Top down approach:
This type of testing starts from upper level modules. Since the detailed activities usually performed in the lower level routines are not provided stubs are written. A stub is a module shell called by upper level module and that when reached properly will return a message to the calling module indicating that proper interaction occurred. No attempt is made to verify the correctness of the lower level module.
Validation:
The system has been tested and implemented successfully and thus ensured that all the requirements as listed in the software requirements specification are completely fulfilled. In case of erroneous input corresponding error messages are displayed
CHAPTER: 8
TEST CASES Test CaseID |
Test Case | Expecting behavior | Exhibiting behavior | Result | 1 | Test whether Server is taking IP address from the Wi-Fi Network | Should show a valid IP address in the network | A valid IP address is taken by the Server | Passed | 2 | Test whether the clients are added into the request queue of the webserver | Show client IP addresses in the Webserver | Showing the connection status of each client with its IP address |
Passed | 3 | Test whether the Web pages are properly accessed in the client browsers | Should show the index.html file whenever the client types server ip address and port no in the browser and should show the linked web pages | Showing the index.html and other web pages properly |
Passed |

CHAPTER: 9 CONCLUSION
The android based static web server is a light weight mobile web server that could be used to serve static web pages from an android mobile to any wireless or wired device like Laptop, Tablet or PC or sometimes even other mobiles which need not be android mobile phones. The static content like uploaded PDF files or PPT files or even Video files in the web server could be accessed by using this web server in any client machine . The access to the web server could be made in the same way as any other PC-based web servers like Apache Tomcat or IIS i.e., via a web browser in the client. The client need not have any heavy software for accessing the content from the static web server, except for a web browser in his device. This feature particularly facilitates a mobile user to share his content to any of clients or colleagues for a promotion of his websites or for transferring easily any content like PPTs, PDFs or Videos to them with out much difficulty. The only requirement is that the server could be started with any existing wi-fi network available in the premises.

FUTURE ENHANCEMENTS

As per the existing mobile computing standards, the possibility of extending a static web server into a dynamic web server is considered to be a future enhancement for this project. Because with this enhancement, the possibility of writing code using server-side scripting languages is very much possible and this is the most cherished dream of a web developer on a mobile platform.
As Android OS is based on Linux Kernel , with little addition of Java APIs for supporting web application with a complete web kit gives opportunity to enhance the functionality of the static web server into a full-fledged dynamic web server. Then the clients can upload any data to the mobile phone acting as webserver and SQLite database functionalities for storing the web data makes it a truly complete web server.

Chapter-10 REFERENCES
Books Referred:
Beginning Android 4 Application Development by Wei-Meng Lee
Beginning Android By Mark Murphy
Professional Android 2 Application Development by Reto Meier(Wrox)
Introducing Android Development with Ice Cream Sandwich by Shane Conder, Lauren Darcey
Sams Teach Yourself Java in 24 Hours (Covering Java 7 and Android) By Rogers Cadenhead
Programming Android By Zigurd Mednieks, Laird Dornin, G. Blake Meike, Masumi Nakamura
Amazing Android Apps For Dummies by Daniel A.Begun

Sites Referred: http://developer.android.com/guide/index.html http://www.codeproject.com/Articles/102065/Android-A-beginner-s-guide http://mobile.dzone.com/articles/fundamentals-android-tutorial http://mobile.tutsplus.com/tutorials/android/java-tutorial/ https://developers.google.com/places/documentation/

Similar Documents