Download Android open source project AOSP is free and easy to

Document related concepts

Entity–attribute–value model wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Database wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Clusterpoint wikipedia , lookup

Transcript
INTERNSHIP REPORT ON
“ANDROID DATA SYNCHRONIZATION
WITH SERVER”
Submitted
In the partial fulfilment of the requirements for
The award of the degree of
BACHELOR OF TECHNOLOGY
In
COMPUTER SCIENCE & ENGINEERING
By
M.DEEPAK
(091FA04025)
C.S.SINDHURA
(091FA04037)
Y.PRAMATHI
(091FA04044)
A. PRANAY REDDY
(091FA04048)
IV Year, Department of Computer Science and Engineering
VIGNAN UNIVERSITY
At
PLUMSOFT SOLUTIONS Pvt. Ltd., HYDERABAD
~i~
INTERNSHIP REPORT ON
“ANDROID DATA SYNCHRONIZATION
WITH SERVER”
Submitted
In the partial fulfilment of the requirements for
The award of the degree of
Bachelor of Technology
In
The Department of Computer Science & Engineering
By
M.DEEPAK
(091FA04025)
C.S.SINDHURA
(091FA04037)
Y.PRAMATHI
(091FA04044)
A. PRANAY REDDY
(091FA04048)
Department of Computer Science and Engineering
VIGNAN UNIVERSITY
Under the esteemed guidance of
K.V. Ravi Sastry
K.V. Krishna Kishore
CEO, Plumsoft Solutions Pvt. Ltd.
D. Yakobu
Assistant Professor
~ ii ~
HOD, CSE
VIGNAN UNIVERSITY
(Accredited by NBA, NAAC ‘A’ grade & ISO 9001:2000 certified Institution)
VADLAMUDI, GUNTUR DIST, ANDHRA PRADESH, INDIA, PIN-522 213
CERTIFICATE
This is to certify that the Internship Report entitled “ANDROID DATA
SYNCHRONIZATION WITH SERVER” that is being submitted by
M.DEEPAK
(091FA04025)
C.S.SINDHURA
(091FA04037)
Y.PRAMATHI
(091FA04044)
A. PRANAY REDDY
(091FA04048)
in partial fulfilment for the award of B.Tech degree in Computer Science and
Engineering to the Vignan’s Foundation for Science, Technology and Research,
Deemed University, is a record of bonafide work carried out by them at Plumsoft
Solutions Pvt. Ltd. under the supervision of Mr. Ravi Sastry under the co-guidance of
the following faculty member of CSE Department.
Signature of Co-Guide
Signature of H.O.D
Mr. D. Yakobu
Department of CSE
Assistant Professor
Vignan University.
Department of CSE
Vignan University.
~ iii ~
DECLARATION
I hereby declare that the project entitled “ANDROID DATA SYNCHRONIZATION
WITH SERVER” submitted for the DEPARTMENT OF COMPUTER SCIENCE
AND ENGINEERING. This dissertation is our original work and the project has not
formed the basis for the award of any degree, associate-ship and fellowship or any
other similar titles and no part of it has been published or sent for publication at the
time of submission.
By
M.DEEPAK
(091FA04025)
C.S.SINDHURA
(091FA04037)
Y.PRAMATHI
(091FA04044)
A. PRANAY REDDY
(091FA04048)
Date: 20-12-2012
~ iv ~
ACKNOWLEDGEMENT
Internship program is a golden opportunity for learning and self-development.
Consider myself very lucky and honored to have so many wonderful people lead me
through in the completion of this project.
I express my gratitude towards the Managing Director of PLUMSOFT
SOLUTIONS Pvt. Ltd., J.V.Ravikumar Sastry, for permitting me to undertake
the INTERNSHIP PROGRAM in their extreme company and for the help and
cooperation throughout the course of my practice school program.
We feel it our responsibility to thank Mr. D.YAKOBU under whose valuable
guidance that the project came out successfully after each stage.
We express our sincere gratitude to MR.T.SATYANARAYANA MURTHY, under
whose valuable guidance that the project came out successfully after each stage.
It is a great pleasure for me to express my grateful thanks to our honourable Director,
of the Internship Program, Assoc Prof.RAVI SANKAR CHANDU, and Prof.K. V.
KRISHNA KISHORE, Hod, of Computer Science Engineering Department of
Vignan University for providing me an opportunity to do my Internship Program in
PLUMSOFT SOLUTIONS Pvt. Ltd. in Hyderabad.
Finally we wish to express thanks to our family members for the love and
affection overseas and forbearance and cheerful depositions, which are vital for
sustaining effort, required for completing this work.
With Sincere regards,
M.DEEPAK
(091FA04025)
C.S.SINDHURA
(091FA04037)
Y.PRAMATHI
(091FA04044)
A. PRANAY REDDY
(091FA04048)
~v~
TABLE OF CONTENTS
ACKNOWLEDGEMENT ..................................................................................................... v
LIST OF FIGURES ............................................................................................................ viii
LIST OF TABLES ................................................................................................................. x
ABBREIVATIONS .............................................................................................................. xi
INTERNSHIP SUMMARY................................................................................................. xii
PROFILE OF THE COMPANY ........................................................................................ xiii
1. INTRODUCTION ............................................................................................................. 2
1.1 Introduction .................................................................................................................. 2
1.2 Literature Survey ......................................................................................................... 2
1.2 Project Background ...................................................................................................... 2
1.3 Objective ...................................................................................................................... 3
1.4 Project Description....................................................................................................... 3
2. SOFTWARE REQUIREMENTS SPECIFICATION ........................................................ 5
2.1 Requirement Analysis .................................................................................................. 5
2.2 Problem Statement ....................................................................................................... 5
2.3 Functional Requirements ............................................................................................. 5
2.4 Software Requirement Specification ........................................................................... 6
2.5 Software Requirements ................................................................................................ 9
2.6 Hardware Requirements............................................................................................. 10
2.7 Functional Requirements (Modules).......................................................................... 10
2.8 Non-Functional Requirements ................................................................................... 11
2.9 External Interface Requirements ................................................................................ 12
2.10 Feasibility study ....................................................................................................... 13
3. ANALYSIS & DESIGN .................................................................................................. 16
3.1 Introduction ................................................................................................................ 16
3.2 System Overview ....................................................................................................... 17
3.3 System Architecture ................................................................................................... 18
3.4 Data Design................................................................................................................ 21
4. MODELING .................................................................................................................... 26
4.1 Design ........................................................................................................................ 26
5. IMPLEMENTATION ...................................................................................................... 36
5.1 Sample Code .............................................................................................................. 36
5.2 Screen Captures ......................................................................................................... 43
6. TESTING ......................................................................................................................... 61
~ vi ~
6.1 Software Testing ........................................................................................................ 61
6.2 Black box Testing ...................................................................................................... 61
6.3 White box Testing ...................................................................................................... 61
6.4 Performance Testing .................................................................................................. 61
6.5 Load Testing .............................................................................................................. 62
6.6 Manual Testing .......................................................................................................... 62
6.7 Testing Tool ............................................................................................................... 66
7. RESULTS AND CHALLENGES ................................................................................... 69
7.1 Results ........................................................................................................................ 69
7.2 Challenges .................................................................................................................. 69
8. CONCLUSION ................................................................................................................ 71
8.1 Conclusions ................................................................................................................ 71
8.2 Scope for future work ................................................................................................ 71
8.3 Limitations ................................................................................................................. 71
BIBLIOGRAPHY ................................................................................................................ 72
~ vii ~
LIST OF FIGURES
Figure 2-1
Android Connect to PHP and MySQL.....………………………………. 9
Figure 3-1
Dalvik Compilation ……….…………………………………………17
Figure 3-2
Android Architecture ...………………………………………….…...18
Figure 3-3
Connection between PHP and Android using HTTP and JSON .........20
Figure 4-1
Use Case Diagram for system ...………………………………..……25
Figure 4-2
Use Case Diagram for Online module …………….………………...26
Figure 4-3
Use Case Diagram for Offline module ………………………….…...26
Figure 4-4
Sequence Diagram for View Customers module …..………………..27
Figure 4-5
Sequence Diagram for Sync Operation …………..………………….28
Figure 4-6
Activity Diagram for Online Module …………………………..…... 29
Figure 4-7
Activity Diagram for Offline Module ………………………..……...30
Figure 4-8
Class Diagram for Offline Module …………………………..………31
Figure 4-9
Deployment Diagram of the System ………………………..……….32
Figure 4-10
ER Diagram ………………………………………………………….33
Figure 5-1
Welcome Activity ………………………………………..…………..42
Figure 5-2
Login Activity ………………………………………….……………43
Figure 5-3
Home Screen Activity ………………………………..……………...44
Figure 5-4
Online module Activity ……………………………..……………….45
Figure 5-5
List of Customers from Server ……………………..………………..46
Figure 5-6
Edit Customer Activity …………………………..…………………..47
Figure 5-7
Visit Activity Flow ……………………………..……………………48
Figure 5-8
Visit Success and List Activity ………………..…………………….49
Figure 5-9
Offline Activity ……………………………..……………………….50
Figure 5-10
Add to SQLite Activity …………………...…………………………51
Figure 5-11
Table View of SQLite Data ………………………………………….52
Figure 5-12
List Activity for Sync and Client Visit ………………………………53
Figure 5-13
Search Results Activity Screen …...…………………………………54
Figure 5-14
Sync and Visit ……………...………………………………………..55
Figure 5-15
Sync Activity ………………………………………………………...56
Figure 5-16
Save Client Visit data Offline …………...…………………………..57
Figure 5.17
List of Offline Visits …………………………………………………58
~ viii ~
Figure 6-1
Performance Statistics ………………………..……………………...60
Figure 6-1
Test Case for Empty Login Fields …………..……………………….61
Figure 6-2
Test Case for Wrong Login Fields ………..…………………………62
Figure 6-3
Add to SQLite Activity Testing ………….………………………….63
Figure 6-4
Test Case for Inserting New Record …….…………………………..64
Figure 6-5
Testroid Recorder …………..………………………………………..65
Figure 6-6
Testroid generated Test.java …………..……………………………..65
~ ix ~
LIST OF TABLES
Table 2:1
Client Requirements …………………………………………………11
Table 2:2
Server Requirements ………………………………………………...11
Table 3:1
MySQL Database ……………………………………………………22
Table 3:2
SQLite RDBMS ……………………………………………………..22
Table 3:3
List of Database Tables ……………………………………………...22
Table 3:4
Structure of entity table of MySQL Database ……………………….22
Table 3:5
Structure of tasksheet table SQLite Database ……………………….23
Table 3:6
Structure of entity table of MySQL Database ……………………….24
Table 3:7
Structure of tasksheet table SQLite Database ……………………….24
~x~
ABBREIVATIONS

ADS
: ANDROID DATA SYNCHRONIZATION

SDK
: SOFTWARE DEVELOPMENT KIT

ADT
: ANDROID DEVELOPMENT KIT

API
: APPLICATION PROGRAMMING INTERFACE

AOSP
: ANDROID OPEN SOURCE PROJECT

AVD
: ANDROID VIRTUAL DEVICE

CRM
: CUSTOMER RELATIONSHIP MANAGEMENT

UI
: USER INTERFACE

JSON
: JAVA SCRIPT OBJECT NOTATION

XAMPP
: WINDOWS/LINUX APACHE MYSQL PERL PHP

PHP
: HYPERTEXT PREPROCESSOR

IDE
: INTEGRATED DEVELOPMENT ENVIRONMENT

HTML
: HYPER TEXT MARKUP LANGUAGE

JDK
: JAVA DEVELOPMENT KIT

XML
: EXTENSIBLE MARKUP LANGUAGE

WIFI
: WIRELESS FIDELITY

AVD
: ANDROID VIRTUAL DEVICES

ADB
: ANDROID DEBUG BRIDGE
~ xi ~
INTERNSHIP SUMMARY
Location: Hyderabad
Center: Plumsoft Solutions Pvt. Ltd.
Duration: 5 Months 18 days
Date of start: 02nd July, 2012
Date of submission: 20th December, 2012
Title of project: Android Data Synchronization with Server
Team Members: M.Deepak
(091FA04025)
C.S.Sindhura
(091FA04037)
Y.Pramathi
(091FA04044)
A. Pranay Reddy
(091FA04048)
Name of the guide: J. Ravi Sastry, Chief Executive Officer, Plumsoft Solutions Pvt.
Ltd.
Hyderabad.
Name of Faculty guide: Mr. Yakobe, Assistant Professor, Vignan University.
Project Area: Android Application Development for Customer Relationship
Management.
Abstract: The current project involves the development of an Android application
that lets you access your customer data anywhere, anytime, from your android
phones. The main aim of the project is to help sales force work with customer
information from remote locations and when you are not connected to a cellular or
Wi-Fi network. Updates will synchronize when you connect to a network with just a
button click.
By streamlining your contacts and client visits into a simple, mobile workflow, ADS
makes growing your business easy.
Signature of Student
Signature of Faculty Guide
Date:
Date:
~ xii ~
PROFILE OF THE COMPANY
What is PLUM?
Plumsoft solutions Pvt. Limited was established in the year 2007 to offer 100% online
ERP tailor made solution for small and medium scale businesses. A low cost and high
quality solution to help improve productivity and gain control over the business of
SMBs.
Plumsoft’s team of the professionals having broad domain expertise in various
industrial and services verticals is a distinct advantage that benefits its customers
immensely, by way of optimal business solutions that are simple and cost-effective.
Plumsoft caters to clients from all sectors like Banking and financial Institutions,
Education, Logistics, Food processing, Engineering, Research, Technologies, Poultry
and Consultancy.
About PLUM
Plumsoft is exclusively in to the Enterprise Solution Development and
Implementations. In a short span, Plumsoft has shown remarkable growth. This
growth has been the result of intelligent application of most appropriate technologies,
flexible and proven methodologies. Satisfied customers have consistently rated
Plumsoft for its high engineering capabilities.
Vision
Develop, Implement and maintain Economic Reliable and powerful enterprise
software at affordable cost to Indian business sector.
Services

Enterprise solutions

ERP Implementation

Framework Services

Consultancy

System study
Indian Office
USA Office
Plumsoft Solutions Pvt. Ltd.
76/A, 2nd Floor Opp. Recreation Club,
6 Kilmer Road, Suite M
Srinagar Colony, Hyderabad 500073
Edison, NJ- 08817
For information:[email protected]
Phone: (888) 4 WISEN (888.494.7736)
~ xiii ~
CHAPTER - 1
INTRODUCTION
The chapter gives brief introduction of the project.
~1~
1. INTRODUCTION
1.1 Introduction
The current project involves the development of an Android application that
lets you access your customer data anywhere, anytime, from your android phones.
The main aim of the project is to help sales force work with customer information
from remote locations and when you are not connected to a cellular or Wi-Fi
network. Updates will synchronize when you connect to a network with just a
button click.
By streamlining your contacts and client visits into a simple, mobile
workflow, ADS makes growing your business easy.
1.2 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 and company strength. Once these things are satisfied, then next steps are
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 are taken into
account for developing the proposed system.

Survey on building applications on Android framework.

Implementation of a framework scripted in PHP.

Different online examples of data synchronization.

Research on web server connectivity with android mobile phone.

Approached different Solutions for the requirement.

Study on Customer Relationship Management.
1.2 Project Background
Most organizations have many sales forces moving across the cities and
collecting the data pertaining to their visits is very critical for business development.
As these people are in move, the internet connectivity becomes an issue to address.
This is addressed by collecting the sales visit data offline in a smart phone and then
syncs the data with that of the corporate server when there is access to internet.
~2~
1.3 Objective
Android Data Synchronization with Web Server is an android application
which contributes to the customer relationship management to organize, automate and
synchronize customer’s details and visit details.
1.4 Project Description
In this section all features in application are explained in brief.
1.4.1 Visit Customers
In the corporate industry marketing their products is one of the main tasks for
an organization. The marketing managers or sales persons have to communicate with
different customers to sell their products. This application serves for the purpose of
storing the details of the customer in their android mobile phone and syncs the
details to the corporate server when they come back to the office.
1.4.2 Save Data to Smart Phone
In this feature, the sales forces can enter customer details such as name, entity
code, contact person, mobile, and email using a user friendly interface to the android
smart phone. The data can be modified, deleted as per requirement. To save client
details the application uses a light weight transactional database management system
called SQLite which is embedded into Android.
1.4.3 Sync Data to Remote Server
This is the key functionality of the application. Once there is internet
connectivity the data stored in the smart phone can be synced to the corporate server.
~3~
CHAPTER - 2
SOFTWARE REQUIREMENT
SPECIFICATION
Gives the details of platform specifications, Hardware and Software specifications.
~4~
2. SOFTWARE REQUIREMENTS SPECIFICATION
2.1 Requirement Analysis
For the purpose of easy access and portability we proposed to develop a smart
phone based system with Android as a platform because it is one of the fastest
growing mobile operating systems on the market and is an open source development.
As a part of this system we are going to develop android-based software in which data
can be accessed and retrieved easily. The required documents for these processes are
as follows.
1. Problem statement
2. Data flow diagrams
3. Use case diagram
4. Other UML diagrams.
The above mentioned documents gives us diagrammatical view of the system
what we are going to develop.
2.2 Problem Statement
The problem statement concentrates on data storage in android’s SQLITE
database and syncing the data to the corporate server.
2.3 Functional Requirements

The application should contribute in the Customer relationship management to
organize, automate and synchronize customer information and client visit details.

The application must have a user friendly interface that stores data directly in the
corporate server when there is network access.

The application must have a view of the listing of data stored in the corporate
server.

The application must have functionalities such as update, delete, and client visit
details directly from the corporate data.

All the server side records must be synced to mobile when online.
 If it is a new record, it must be stored to mobile phone
 Existing records must be updated in mobile phone.
 Unsynchronized records of mobile phone must not be disturbed.

The application must have a user friendly interface to provide customer details,
which can be stored in the android database.
~5~

It must have a view of the list of records in the database.

The new records inserted must be synced to server when online.

For handiness the records once inserted in local db must be able to be modified or
deleted.

The application must be able to store visit data pertaining to a customer.

Search Engine for all the customer details stored in the mobile database.

Essential steps to be taken to prevent authenticity infringement.
2.4 Software Requirement Specification
The project is developed in Java Programming Language by using the Eclipse
Juno Integrated Development Environment (IDE). We use the Android Software
Development Kit (SDK) which includes a variety of custom tools that help us to
develop mobile applications on the android platform. The most important of these are
the Android Emulator and the Android Development Tools (ADT) plug-in for
Eclipse. At the Server side XAMPP Server is used. XAMPP stands for
Windows/Linux operating system, Apache Web Server, MySQL, Perl, and PHP.
2.4.1 Purpose
The purpose of this document is to present a detailed description of “Android
Data Synchronization with Server” application. It will explain the purpose and
features of the system that it will provide, constraints under which it must operate and
how the system will react. The document also describes the non functional
requirements of the system.
2.4.2 Scope of the project
The application has two main modules. They are online mode and offline
mode.
1) ONLINE
Online mode works when there is internet connectivity. User can directly interact
with the corporate server. On clicking the online button on the launch screen directs
to an activity with three buttons each having its own specific functionality. They are:
i. View Customers
ii. Add New Customers
iii. Sync server data to SQLite
iv. Logout
~6~
2) OFFLINE
Offline mode has an interface to store the customer details and client visit details
to android smart phone database and allows syncing the new data to corporate server
after acquiring internet connectivity. The offline screen contains two buttons. They
are:
i. Add to SQLite Database
ii. Sync and client visit.
iii. Logout
2.4.3 Technologies Used
 JAVA
Java is an object-oriented programming language developed by Sun
Microsystems a company best known for its high end UNIX workstations.
Java language was designed to be small, simple, and portable across
platforms, operating systems, both at the source and at the binary level, which
means that Java programs (applet and application) can run on any machine
that has the Java virtual machine (JVM) installed.
 XML
Extensible Mark-up Language is a text based format that let developers
describe, deliver and exchange structured data between a range of applications
to client for display and manipulation.
 JSON
JavaScript Object Notation is a text-based data interchange format designed
for transmitting structured data. It is most commonly used for transferring data
between web applications and web servers.
 SQLITE
SQLite is an Open Source Database which is embedded into Android. SQLite
supports standard relational database features like SQL syntax, transactions
and prepared statements. In addition it requires only little memory at runtime
(approx. 250 Kbytes).
 PHP
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
open source general-purpose scripting language that is especially suited for
web development and can be embedded into HTML.
~7~
 HTML
Hypertext Markup Language is the main markup language for displaying
web pages and other information that can be displayed in a web browser.
 JAVASCRIPT
JavaScript is a scripting language commonly implemented as part of a web
browser in order to create enhanced user interfaces and dynamic websites.
 APACHE WEB SERVER
Apache is generally recognized as the world’s most popular web Server
(HTTP server).It provides a full range of web server features, including CGI,
SSL, and virtual domains. Apache also supports plug-in modules for
extensibility.
 MySQL
MySQL is one of the most popular relational database management systems
on the web. MySQL is used for the internet applications as it provides good
speed and is very secure. MySQL was developed to manage large volumes of
data at very high speed to overcome the problems of existing solutions.
2.4.4 Overview
The application is based on Android platform an application which
communicates with the server allowing the collection of sales visit data offline and
then syncs the data with that of the corporate server when there is access to the
internet.
2.4.5 Overall Description
The objective of this document therefore is to formally describe the system’s
high
level
requirements
including
functional
requirements,
non-functional
requirements. The detail structure of this document is organized as follows:
Section 1 of this document provides an overview of the ADS application. This
includes a general description of the product, user characteristics, general constraints,
and any assumptions for this system. This model demonstrates the development team
understands of the application with limited fields as a proof of concept and serves to
maximize the team’s ability to build a system that truly does support the business.
Section 2 presents the detail requirements, which comprise the domain.
Section 3 consists of the modeling, low level and high level designing and
screen captures demonstrating the functional requirements.
~8~
Section 4 shows testing the application using different testing techniques like
load testing, performance testing, manual testing etc.
2.4.6 Specific Requirements
This section will describe the functions of actors, their roles in the system and
the constraints faced by the system.
2.4.7 Product Perspective
The proposed system is used in the customer relationship management by the
sales executives. This system will provide the sales executives to add data to the
android database. As the sales executives are in move, they may not have internet
connectivity. When in offline mode the customer details and the client visit details
will be stored in the SQLite database of the android smart phone after receiving
access to internet, may be after reaching the office WIFI, the customer data is synced
to the server. Using the client browser the data can be queried from the Apache
server.
Figure 2-1 Android Connect to PHP and MySQL
2.5 Software Requirements
The software interface is the operating system, and application programming
~9~
interface used for the development of the software.
Operating System: Windows XP or higher / Mac OS X 10.5.8 or later / Linux
Platform: Android SDK Framework
IDE: Eclipse 3.5(Galileo) or higher
Android Emulator: SDK Version 1.7 or Higher
Database: SQLite, MySQL
Technologies used: Java, XML, PHP.
2.6 Hardware Requirements
CLIENT
SMARTPHONE
OPERATING
SYSTEM
SAMSUNG Ace
Duos
Android 2.1 I
SOFTWARE
Ads.apk file
PROCESSOR
RAM
Cortex-A15
MP Core
processor
256 Mb
Table 2:1 Client Requirements
SERVER
OPERATING
SYSTEM
SOFTWARE
PROCESSOR
RAM
DISK
SPACE
Ubuntu 12.04
LTS
PHP 5.3.10
Apache 2.2.22
MySQL 5.5.2
IntelI XeonI
CPU E31220
256Mb
Minimum
250Mb
Table 2:2 Server Requirements
2.7 Functional Requirements (Modules)
The project has two main modes Online and Offline each having its own
respective specific functionality.
2.7.1 View Customers:
This activity works in the online mode. The application calls the PHP script
using a JSON object in order to retrieve the customer details from the entity table of
the MySQL database in the server. It contains a list of records. On clicking a
customer record an onclick event is generated leading to the Edit customer activity
sending the customer id of the item clicked.
2.7.2 Edit Customer Details:
This activity generates the customer details of the customer id sent from the
view customer activity. We can edit the customer details of this particular id and the
changes will get saved in the entity table of the MySQL database in the server. It also
~ 10 ~
contains a visit button, on clicking, a new intent of Client Visit activity get started.
2.7.3 Client Visit:
The Client Visit activity is to store information about the purpose of their visit
to the customer and type of visit for example meeting, conference, union meeting, or
online meeting etc in the task sheet table of the MySQL database in the server.
2.7.4 Add New Customers:
This activity allows to directly adding new customer details to the corporate
database when connected to the server.
2.7.5 Sync Server data to SQLite:
This activity syncs the data from the corporate server and stores it in the
SQLite database of the android smart phone.
2.7.6 Add to SQLite Database:
This feature works in the offline mode. It contains an interface to add
customer details and store it in the SQLite database of the android smart phone. The
activity contains a button to view the contents of the SQLite database in a table
format. It has other functionalities such as get information, modify and delete
customer details.
2.7.7 Sync customer data
To sync data, from the list of customer details stored in the mobile phone
select the particular customer id and click on the sync button. If the sync is successful
the server sends a success message using a JSON object. If the same customer details
are tried to be synced again the sync operation fails as the customer id is a unique key
in the server database.
2.7.8 Visit Customer:
The Client Visit activity is to store information about the purpose of their visit
to the customer and type of visit for example meeting, conference, union meeting, or
online meeting etc in the task sheet table of the SQLite database in the android
phones.
2.8 Non-Functional Requirements
2.8.1 Flexibility & Scalability
Google itself has given a set of applications with android but the whole
developer community can develop their own applications and they have access to
same resources and public API which are accessible to core applications.
~ 11 ~
2.8.2 Robust
It is quite robust because it’s based on Linux, Linux 2.6 precisely and it gives
a lot of freedom to end user. The end user can choose what application to use either
the core application or downloaded application for any activity.
2.8.3 Fragmentation
Android gave the same environment which is open; the entire API’s which is
open to all the mobile devices which reduces fragmentation. If you develop an
android application, it will run on all the android devices.
2.8.4 Open Source:
Android open source project AOSP is free and easy to download. Android is a
Linux based operating system and is one of the fastest growing mobile operating
systems on the market.
2.8.5 Performance:
There are two primary factors by which Android’s application performance is
measured. The first factor is the efficiency with which the application performs
central processing commands. The second factor is the speed with which the
application renders two- and three-dimensional graphics on the Android’s screen.
2.8.6 Reliability:
Since the application is being developed through java, the most famous,
efficient and reliable language, so it is reliable in every aspect until and unless there is
an error in the programming side. Thus the application can be a compatible and
reliable one.
2.8.7 Portability:
This System must be intuitive enough such that user with average background
in using mobile phones can quickly experiment with the system and learn how to use
the project. The system has user friendly interface.
2.9 External Interface Requirements
2.9.1 User Interface
A critical aspect of this project was examining how the app would look and its
usability. The layout of android applications is defined in a XML file (in this case
firstscreen.xml, online.xml and offline.xml)
~ 12 ~
When the App is launched, it displays the First Screen- an activity that contains the
logo of the Plum Soft Solutions Company for whom we have implemented this
project. The layout displays buttons for online activity and offline activity. The
application has a user friendly interface with Edit Text fields, spinner, progress bars
etc.
2.9.2 Event log/database
Once the Sync Event is created, it needs to be stored somewhere.
The Android API supports development of a SQLite database. SQLite is “a software
library that implements a self-contained, server less, zero-configuration, transactional
SQL database engine 18. Data is stored in the database.
The initial design included a list view that read the entries in the database and
displayed them using the ListView format. Users could remove events from the list
which would delete them from the table.
On clicking the sync button the application would transmit the SQL data to an
external server using the Java Script Object Notation (JSON) parser.
2.10 Feasibility study
A key part of the preliminary investigation that reviews anticipated costs and
benefits and recommends a course of action based on operational, technical,
economic, and time factors. The purpose of the study is to determine if the systems
request should proceed further.
2.10.1 Organisational Feasibility
The application would contribute to the overall objectives of the organization.
It would provide a quick, error free and cost effective solution to the current process
CRM marketing. It would provide a solution to many issues in the current system. As
the new system is flexible and scalable it can also be upgraded and extended to meet
other complex requirements which may be raised in the future. However it is up to the
organization to upgrade or extend it.
2.10.2 Economic Feasibility
The project is economically feasible as it only requires a mobile phone with
Android operating system. The application is free to download once released into
Android market. The users should be able to connect to internet through mobile
phone and this would be the only cost incurred on the project.
~ 13 ~
2.10.3 Technical Feasibility
To develop this application, a high speed internet connection, a database
server, a web server and software are required. The current project is technically
feasible as the application was successfully deployed on LG Optimus GT540 smart
phone having Android Firmware version 2.1 and also on Samsumg Galaxy firmware
version 2.3.
2.10.4 Behavioural Feasibility
The application is behaviourally feasible since it requires no technical
guidance, all the modules are user friendly and execute in a manner they were
designed to.
~ 14 ~
CHAPTER - 3
ANALYSIS & DESIGN
This chapter gives the details of the system and data design.
~ 15 ~
3. ANALYSIS & DESIGN
3.1 Introduction
3.1.1 Purpose
In this section the purpose of the document and the project is described.
3.1.1.1 Document Purpose
An SDD is a representation of a software system that is used as a medium for
communicating software design information.
3.1.1.2 Project Purpose
The prime purpose of this “Android Data Synchronization with Web Server
application” is to create a fully fledged android application which would
communicate with the remote server to send and retrieve corporate data as per
requirement. This application works when there is internet connectivity
The application retrieves customer details from the server and syncs it to the android
mobile phone. These details can be stored in the SQLite database. The retrieved
information can be updated in the mobile phone and synched to the server. The
advantage of this app is if due to low network there is no access to the internet, the
new customer details and updated details can be added in the SQLite database in the
android phone and later synched to the server when there is access to the internet.
3.1.2 Scope
In this section the scope of the document and the project is explained in brief.
3.1.2.1 Document Scope
This document contains a thorough description of the high level architecture
that will be used in developing the system. Communicating at a purposefully high
level, it will only form the basis for the Software Detailed Design and
implementation. However, the SDD itself will not be in sufficient detail to implement
the code. It will convey the overall system design of the system, the user interface
design and higher level module design (including android development tools) and the
architecture of the Linux kernel and the working of the Dalvik Virtual Machine.
Design details that will not be included in the SDD are:

Low level classes that will be used in the implementation. The full description
of the implementation of each module is not needed, but the public modules that
will be interfaced will be described.
~ 16 ~

Exact detailed description of interactions within each module.
3.1.2.2 Project Scope
ADS application mainly consists of two modules with each having definite
functionality. The purpose of module one, ONLINE is to add, view and edit the
customer details and client visit details when there is access to the internet. Module
two works when there is no internet access. The customer details can be stored in the
android smart phone. A view to the records in the SQLite database can be seen. This
data can be synced to the server whenever there is access to the internet. The offline
mode has additional features like update, delete and visit customer. The client visit
interface store data about the visit like the type of meeting, subject of discussion etc.
3.2 System Overview
3.2.1 Development Tools
Android framework uses certain development tools which are as follows:
3.2.1.1 Android SDK
The Android Software Development Kit (SDK) contains the necessary tools to
create, compile and package Android application. Most of these tools are command
line based. The Android SDK also provides an Android device emulator, so that
Android applications can be tested without a real Android phone. You can
create Android virtual devices (AVD) via the Android SDK, which run in this
emulator. The Android SDK contains the Android debug bridge (adb) tool which
allows connecting to a virtual or real android device.
3.2.1.2 Android Development Tools
Google provides the Android Development Tools (ADT) to develop Android
applications with Eclipse. ADT is a set of components (plug-ins) which extend the
Eclipse IDE with Android development capabilities.ADT contains all required
functionalities to create, compile, debug and deploy Android applications from the
Eclipse IDE. ADT also allows creating and starting AVDs. The Android
Development Tools (ADT) provides specialized editors for resources files, e.g. layout
files. These editors allow switching between the XML representation of the file and a
richer user interface via tabs on the bottom of the editor.
~ 17 ~
3.2.1.3 Dalvik Virtual Machine
The Android system uses a special virtual machine, i.e. the Dalvik Virtual Machine to
run Java based applications. Dalvik uses an own byte code format which is different
from Java byte code. Therefore you cannot directly run Java class files on Android;
they need to get converted in the Dalvik byte code format.
 Runs optimized file format (dex) and Dalvik byte code.
 Java .class/.jar files converted to .dex at build time.
 Supports multiple virtual machine processes per device.
Figure 3-1 Dalvik Compilation
3.3 System Architecture
3.3.1 Architectural Design
Android is based on the Linux Kernel. Android Developers are able to access
all the components of the Application Framework used by core applications when
creating an application.
Libraries shown in green color are native libraries written in C and C++
exposing various capabilities through Android application framework which are in
turn used by the applications. Some of the libraries are Libc, a standard C library
tuned for embedded Linux based devices, SGL/OpenGL for 2D/3D Graphics Support,
Freetype used for bitmap & vector font rendering, SQLite, a lightweight relational
database engine, and a Surface Manager which manages access to display subsystem.
One of the critical component added here is Android Runtime. Dalvik
Virtual Machine is part of Android Runtime. It also contains Core API’s which
provides a substantial subset of Java 5 Standard Edition. It gives various Data
Structures, File Access, Network Access, and Graphics Support.
The Application Framework enables reuse of various components. Some of
the components are:
 Activity Manager: Manages lifecycle of the applications and a common “backstack” for user navigation
~ 18 ~
 Package Manager: Holds information about applications loaded in the system.
 Resource Manager: Access to non-code resources such as localized strings
 Content Provider: Access data from other applications (such as Contacts), or to
share their own data.
 Notification Manager: To display custom alerts in the status bar
 Location Manager: Handle information about location
Figure 3-2 Android Architecture showing the major components of Android OS
3.3.2 How is .apk generated?
Android application package file (APK) is the file format used to distribute
and install application software and middleware onto Google’s Android operating
system. To make an APK file, a program for Android is first compiled, and then all of
its parts are packaged into one file. This holds all of that program’s code (such as .dex
files), resources, assets, certificates, and manifest file. As is the case with many file
formats, APK files can have any name needed, but must end with the four characters,
three letter extension, .apk.
An application in an Android is nothing but a dot APK file. When we compile
and build our source code we get a dot APK file which contains the whole application
package. When we start application development we have got Java source file and we
have got our resources which are non code resources.
~ 19 ~
But Java source file passes through the Java compiler and gives us an output
as .class files standard Java application developer process. Then this .class files are
given as an input to dx tool which gives us .dex files, then we have got a tool called
AAPT which is nothing but Application Asset Packaging Tool which takes .dex file
as well as these XML and PNG and packs it into an APK and finally this is an APK
file which gets installed on mobile devices. So this briefs how we convert our source
code resources into final APK file which gets installed on a mobile device.
3.3.3 Application Components
An Android Application has four parts- Activities, Services, Broadcast
Receivers and Content Providers.
 Activities: Activities are the visual interfaces for each task in the application. We
can instantiate an activity from any other activity or screen. To switch from one
screen to another screen android uses a mechanism of messaging called Intents
and Intent Filters. Activities in my application might include the List Views and
Table layouts for the display of the SQLite’s data containing customer details and
client visit details and forms to insert and sync data to remote server.
 Services: Services are the background tasks that don’t have a user interface.
Services might be linked to one or more activities. A service performs long
running operations or performs work for remote processes. In this application
Services would include syncing the data to the remote server (when there is
internet connectivity.)
 Content Providers: A content provider manages a shared set of application data.
You can store the data in the file system, a SQLite database, on the web, or any
other persistent/ storage location your application can access. Through the content
provider, other applications can query or even modify the data (if the content
provider allows it).
 Broadcast Receivers: A broadcast receiver is a component that responds to
system-wide broadcast announcements. Many broadcasts originate from the
system—for example, a broadcast announcing that the screen has turned off, the
battery is low, or a picture was captured.
~ 20 ~
3.3.4 Overall Software Architecture
Figure 3-3 Connection between PHP (server) and Android (client) using HTTP and
JSON
The architecture shown in above figure is used in the sync operation where the
data from android goes to web server (PHP) to database server (MySQL). PHP is used
here because of the interaction it can offer with the databases and it is easy to deploy
on the XAMPP web server and here it sits in middle as shown in figure. On Android,
HTTP Client is used to communicate with web server (PHP). JSON (JavaScript
Object Notation) is a lightweight text-based open standard designed for humanreadable data interchange and it is used in this application to send data from Android
device to PHP Script. SQL insert query is written in PHP script to insert this data into
MySQL database server.
3.4 Data Design
3.4.1 Databases
MySQL RDBMS
Name
Vignan_intern
Table 3:3 MySQL Database
~ 21 ~
SQLite RDBMS
Name
Ads.db
Table 3:4 SQLite RDBMS
3.4.2 Tables
Name
Description
Entity
MyISAM
Tasksheet
MyISAM
Table 3:5 List of Database Tables
3.4.2.1 Database: vignan_intern Table: entity
Description
MyISAM
Columns
Name
Type
Null
Default
id
Int
No
entitycode
Varchar(80)
Yes
NULL
Name
Varchar(80)
Yes
NULL
contactperson
Varchar(50)
Yes
NULL
Email
Varchar(50)
Yes
NULL
Mobile
Varchar(50)
Yes
NULL
Index
Primary Key Auto Increment
Unique Key
Table 3:6 Structure of entity table of MySQL Database
Definition
CREATE TABLE IF NOT EXISTS `entity` (
`id` varchar(20) NOT NULL AUTO_INCREMENT,
`entitycode` varchar(80) DEFAULT NULL,
`name` varchar(80) DEFAULT NULL,
`contactperson` varchar(50) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`mobile` varchar(50) DEFAULT NULL) ENGINE = MyISAM;
3.4.2.2 Database: vignan_intern Table: tasksheet
Description: MyISAM
~ 22 ~
Columns:
Name
Type
Null
Varchar(20)
No
Tasktype
Varchar(50)
Yes
NULL
Task
Longtext
Yes
NULL
Subject
Varchar(255)
Yes
NULL
id
Default
Index
Primary Key , Unique Key
Table 3:7 Structure of tasksheet table SQLite Database
Definition:
CREATE TABLE `tasksheet` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`tasktype` VARCHAR( 50 ) NULL ,
`task` LONGTEXT NULL ,
`subject` VARCHAR( 255 ) NULL
) ENGINE = INNODB;
3.4.2.1 Database: Ads.db Table: entity
Description: MyISAM
Columns:
Name
Type
Null
INTEGER
No
Id
TEXT
No
Entitycode
TEXT
No
NULL
Name
TEXT
No
NULL
contactperson
TEXT
No
NULL
Email
TEXT
No
NULL
Mobile
TEXT
No
NULL
_id
Default
Index
Primary Key Auto Increment
Table 3:8 Structure of entity table of MySQL Database
Definition:
CREATE TABLE IF NOT EXISTS `entity` (
`_id` INTEGER PRIMARY KEY AUTO_INCREMENT,
`id` TEXT NOT NULL,
`entitycode` TEXT NOT NULL,
`name` TEXT NOT NULL,
~ 23 ~
`contactperson` TEXT NOT NULL,
`email` TEXT NOT NULL,
`mobile` TEXT NOT NULL) ENGINE = MyISAM;
3.4.2.3 Database: Ads.db Table: tasksheet
Description: MyISAM
Columns:
Name
Type
Null
varchar(20)
No
Tasktype
varchar(50)
Yes
NULL
Task
Longtext
Yes
NULL
Subject
varchar(255)
Yes
NULL
id
Default
Index
Primary Key , Unique Key
Table 3:9 Structure of tasksheet table SQLite Database
Definition
CREATE TABLE `tasksheet` (
`_id` INTEGER AUTO_INCREMENT PRIMARY KEY,
`id` TEXT,
`tasktype` TEXT,
`task` TEXT,
`subject` TEXT
) ENGINE = INNODB;
~ 24 ~
CHAPTER - 4
MODELING
This chapter gives the unified modeling language diagrams.
~ 25 ~
4. MODELING
4.1 Design
Requirements gathering followed by careful analysis leads to a systematic
Object Oriented Design (OOAD). Various activities have been identified and are
represented using Unified Modeling Language (UML) diagrams. UML is used to
specify, visualize, modify, construct and document the artifacts of an object-oriented
software-intensive system under development.
4.1.1. Use Case Diagram
In the Unified Modeling Language (UML), the use case diagram is a type of
behavioral diagram defined by and created from a use-case analysis. It represents a
graphical over view of the functionality of the system in terms of actors, which are
persons, organizations or external system that plays a role in one or more interaction
with the system. These are drawn as stick figures. The goals of these actors are
represented as use cases, which describe a sequence of actions that provide something
of measurable value to an actor and any dependencies between those use cases.
In this application there is only actor – soldier and below is the use case
diagram of this application.
Figure 4-1 Use Case Diagram for System
~ 26 ~
Figure 4-2 Use Case Diagram for Online Module
Figure 4-3 Use Case Diagram for Offline Module
~ 27 ~
4.1.2 Sequence Diagram
UML sequence diagrams are used to show how objects interact in a given
situation. An important characteristic of a sequence diagram is that time passes from
top to bottom: the interaction starts near the top of the diagram and ends at the bottom
(i.e. Lower equals later).
A popular use for them is to document the dynamics in an object-oriented
system. For each key, collaboration diagrams are created that show how objects
interact in various representative scenarios for that collaboration.
Sequence diagram is the most common kind of interaction diagram, which
focuses on the message interchange between a numbers of lifelines.
The following nodes and edges are typically drawn in a UML sequence
diagram: lifeline, execution specification, message, combined fragment, interaction
use, state invariant, continuation, destruction occurrence.
Figure 4-4 Sequence Diagram for View Customers Module
~ 28 ~
Figure 4-5 Sequence Diagram for Sync operation
~ 29 ~
4.1.3 Activity Diagram
Activity diagram is another important diagram in UML to describe dynamic
aspects of the system. Activity diagram is basically a flow chart to represent the flow
form one activity to another activity. The activity can be described as an operation of
the system.So the control flow is drawn from one operation to another. This flow can
be sequential, branched or concurrent. Activity diagrams deals with all type of flow
control by using different elements like fork, join etc.Activity is a particular operation
of the system.
Fig 4-6 Activity Diagram for Online Module
~ 30 ~
Fig 4-7 Activity diagram for Offline Module
~ 31 ~
4.1.4 Class Diagram
In software engineering, a class diagram in the Unified Modeling Language
(UML) is a type of static structure diagram that describes the structure of a system by
showing the system’s classes, their attributes, operations (or methods), and the
relationships among the classes.
The class diagram is the main building block of object oriented 32odeling. It is
used both for general conceptual 32odeling of the 32odeling32c of the application,
and for detailed 32odeling translating the models into programming code. Class
diagrams can also be used for data modeling. The classes in a class diagram represent
both the main objects, interactions in the application and the classes to be
programmed.
Figure 4-8 Class Diagram for Offline Module
~ 32 ~
4.1.5 Deployment Diagram
Deployment diagram shows execution architecture of systems that represent
the assignment (deployment) of software artifacts to deployment targets (usually
nodes).
Nodes represent either hardware devices or software execution environments. They
could be connected through communication paths to create network systems of
arbitrary complexity. Artifacts represent concrete elements in the physical world that
are the result of a development process and are deployed on nodes.
Figure 4-9 Deployment Diagram of the system
~ 33 ~
4.1.6 ER Diagram
An ER model is an abstract way to describe a database. Describing a database
usually starts with a relational database, which stores data in tables. Some of the data
in these tables point to data in other tables - for instance, your entry in the database
could point to several entries for each of the phone numbers that are yours. The ER
model would say that you are an entity, and each phone number is an entity, and the
relationship between you and the phone numbers is 'has a phone number'. Diagrams
created to design these entities and relationships are called entity–relationship
diagrams or ER diagrams.
Figure 4-10 ER Diagram
~ 34 ~
CHAPTER - 5
IMPLEMENTATION
The chapter gives the details of the implementation.
~ 35 ~
5. IMPLEMENTATION
5.1 Sample Code
5.1.1 Code for all_customers.xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!-- Main ListView Always give id value as list(@android:id/list)-->
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="10sp"
android:textColor="#00FF00"
android:gravity="center_vertical|center_horizontal"/>
</TableLayout>
5.1.2 Code for list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- Entity id (eid) - will be HIDDEN - used to pass to other activity -->
<TextView
android:id="@+id/eid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<!-- EntityCode Label -->
<TextView
android:id="@+id/lentitycode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="6dip"
android:paddingLeft="6dip"
android:textSize="17dip"
android:textStyle="bold" />
<!-- Name Label -->
<TextView
android:id="@+id/lname"
~ 36 ~
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="6dip"
android:paddingLeft="6dip"
android:layout_toRightOf="@+id/lentitycode"
android:textSize="17dip"
android:textStyle="bold" />
<TextView
android:id="@+id/lcontactperson"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="6dip"
android:paddingLeft="6dip"
android:layout_toRightOf="@+id/lname"
android:textSize="17dip"
android:textStyle="bold" />
<TextView
android:id="@+id/lemail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="6dip"
android:paddingLeft="6dip"
android:layout_toRightOf="@+id/lcontactperson"
android:textSize="17dip"
android:textStyle="bold" />
<TextView
android:id="@+id/lmobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="6dip"
android:paddingLeft="6dip"
android:layout_toRightOf="@+id/lemail"
android:textSize="17dip"
android:textStyle="bold" />
</RelativeLayout>
5.1.3 Code for AllCustomersActivity.java
package com.sppd.adswws;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.http.NameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
~ 37 ~
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
public class AllCustomersActivity extends ListActivity {
// Session Manager Class
SessionManager session;
// Progress Dialog
private ProgressDialog pDialog;
// Creating JSON Parser object
JSONParser jParser = new JSONParser();
ArrayList<HashMap<String, String>> entityList;
private String url_all_customers = UrlsFile.url_all_customers;
// JSON Node names
private static final String TAG_SUCCESS = "success";
private static final String TAG_ENTITY = "entity";
private static final String TAG_EID = "eid";
private static final String TAG_ENTITYCODE = "entitycode";
private static final String TAG_NAME = "name";
private static final String TAG_CONTACTPERSON = "contactperson";
private static final String TAG_EMAIL= "email";
private static final String TAG_MOBILE= "mobile";
String TO="to";
// products JSONArray
~ 38 ~
JSONArray entity = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.all_customers);
// Session class instance
session = new SessionManager(getApplicationContext());
Toast.makeText(getApplicationContext(),"UserLoginStatus: " + session.isLoggedIn(),
Toast.LENGTH_LONG).show();
/**
* Call this function whenever you want to check user login
* This will redirect user to LoginActivity is he is not
* logged in
* */
session.checkLogin();
// Hashmap for ListView
entityList = new ArrayList<HashMap<String, String>>();
// Loading products in Background Thread
new LoadAllProducts().execute();
// Get listview
ListView lv = getListView();
// on seleting single product
// launching Edit Product Screen
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
// getting values from selected ListItem
String eid = ((TextView) view.findViewById(R.id.eid)).getText().toString();
// Starting new intent
Intent in = new Intent(getApplicationContext(),AndroidTabLayoutActivity.class);
in.putExtra(TO, "EditCustomerActivity.class");
in.putExtra(TAG_EID, eid);
// starting new activity and expecting some response back
startActivityForResult(in, 100);
}
~ 39 ~
});
}
// Response from Edit Product Activity
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// if result code 100
if (resultCode == 100) {
// if result code 100 is received
// means user edited/deleted product
// reload this screen again
Intent intent = getIntent();
finish();
startActivity(intent);
}
}
/**
* Background Async Task to Load all product by making HTTP Request
* */
class LoadAllProducts extends AsyncTask<String, String, String> {
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(AllCustomersActivity.this);
pDialog.setMessage("Loading customers. Please wait...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
/**
* getting All products from url
~ 40 ~
* */
protected String doInBackground(String... args) {
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
// getting JSON string from URL
JSONObject json = jParser.makeHttpRequest(url_all_customers, "GET", params);
// Check your log cat for JSON reponse
Log.d("All entity: ", json.toString());
try {
// Checking for SUCCESS TAG
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
// products found
// Getting Array of Products
entity = json.getJSONArray(TAG_ENTITY);
// looping through All Products
for (int i = 0; i < entity.length(); i++) {
JSONObject c =entity.getJSONObject(i);
// Storing each json item in variable
String id = c.getString(TAG_EID);
String entitycode= c.getString(TAG_ENTITYCODE);
String name = c.getString(TAG_NAME);
String contactperson = c.getString(TAG_CONTACTPERSON);
String email = c.getString(TAG_EMAIL);
String mobile= c.getString(TAG_MOBILE);
// creating new HashMap
HashMap<String, String> map = new HashMap<String, String>();
// adding each child node to HashMap key => value
map.put(TAG_EID, id);
map.put(TAG_ENTITYCODE, entitycode);
map.put(TAG_NAME, name);
map.put(TAG_CONTACTPERSON, contactperson);
map.put(TAG_EMAIL, email);
map.put(TAG_MOBILE, mobile);
~ 41 ~
// adding HashList to ArrayList
entityList.add(map);
}
} else {
// no products found
// Launch Add New product Activity
Intent i = new Intent(getApplicationContext(),NewCustomerActivity.class);
// Closing all previous activities
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
/**
* After completing background task Dismiss the progress dialog * **/
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
runOnUiThread(new Runnable() {
public void run() {
// Updating parsed JSON data into ListView
ListAdapter adapter = new SimpleAdapter(
AllCustomersActivity.this, entityList,
R.layout.list_item, new String[] {TAG_EID,TAG_NAME}, new int[] { R.id.eid,
R.id.lname });
setListAdapter(adapter);
}
});
}
}
}
~ 42 ~
5.2 Screen Captures
5.2.1 Welcome Screen
Figure 5-1 Welcome Activity
Description: After launching the application a Welcome message will come into
view.
~ 43 ~
5.2.2 Login Screen
Figure 5-2 Login Activity
Description: The application has an administrator login which is used by the sales
force to start the application to prevent authenticity infringement.
~ 44 ~
5.2.3 Home Screen
Figure 5-3 Home Screen Activity
Description: The Home Screen Activity contains Online and Offline buttons each
leading to different activities. Online mode works when there is internet connectivity.
User can directly interact with the corporate server. On clicking the online button on
the launch screen directs to an activity with three buttons each having its own specific
functionality. Offline mode has an interface to store the customer details and client
visit details to android smart phone database and allows syncing the new data to
corporate server after acquiring internet connectivity.
~ 45 ~
5.2.4 Online Screen
Figure 5-4 Online Module Activity
Description: Online mode works when there is internet connectivity. User can directly
interact with the corporate server. He can view the list of customers retrieved from the
server, edit and update the customer details, delete unwanted customer add visit
details about the meeting with the customer.
The Add New Customers button leads to an activity where in customer details
can be added to the server directly from the smart phone.
The Sync server data to Phone button is used to download the records of the
customer table of MySQL database to SQLite database of android smart phone.
~ 46 ~
5.2.5 View Customers Activity
Figure 5-5 List of Customers from Server
Description: This activity works in the online mode. The application calls the PHP
script using a JSON object in order to retrieve the customer details from the entity
table of the MySQL database in the server. It contains a list of records. On clicking a
customer record an onclick event is generated leading to the Edit customer activity
sending the customer id of the item clicked.
~ 47 ~
5.2.6 Edit Customer Activity
~ 48 ~
5.2.7 Visit Customers
Figure 5-7 Visit Activity Flow
Description: The Client Visit activity is to store information about the purpose of
their visit to the customer and type of visit for example meeting, conference, union
meeting, or online meeting etc in the task sheet table of the MySQL database at the
server.
~ 49 ~
5.2.8 Visit Customers Contd
Figure 5-8 Visit Success and List Activity
Description: After saving the list of client visit details with auto- generated client ids
is shown in next the activity.
~ 50 ~
5.2.9 Offline Module
Figure 5-9 Offline Activity
Description: Offline mode has an interface to store the customer details and client
visit details to android smart phone database and allows syncing the new data to
corporate server after acquiring internet connectivity.
~ 51 ~
5.2.10 Add To SQLite Activity
Figure 5-10 Add to SQLite Activity
Description: This feature works in the offline mode. It contains an interface to add
customer details and store it in the SQLite database of the android smart phone. The
activity contains a button to view the contents of the SQLite database in a table
format. It has other functionalities such as get information, modify and delete
customer details.
~ 52 ~
5.2.11 Table View of SQLite Data
Figure 5-11 Table View of SQLite data
Description: On clicking the view button opens an activity with the list of records in the
entity table of the ads database in SQLite database management system. The records with id 0
are new records stored in the phone memory, which are not yet synced to the server.
~ 53 ~
5.2.12 Listing for Sync and Client Visit
Figure 5-12 List Activity for Sync and Client Visit
Description: List of records with search functionality to update existing records in the
online database or offline database.
~ 54 ~
5.2.13 Search Activity
Figure 5-13 Search Results Activity Screen
Description: Activity showing search results.
~ 55 ~
5.2.14 Customer details to be synced or visited
Figure 5-14 Sync and Visit
Description: On clicking the list item shows an activity with update, delete, visit,
sync functionalities for the offline data.
~ 56 ~
5.2.15 Sync Activity
Figure 5-15 Sync Activity
Description: To sync data, from the list of customer details stored in the mobile
phone select the particular customer id and click on the sync button. If the sync is
successful the server sends a success message using a JSON object. If the same
customer details are tried to be synced again the sync operation fails as the customer
id is a unique key in the server database.
The view of the three new records synced to the server is shown in the above
screen.
~ 57 ~
5.2.16 Save Client Visit data Offline
Figure 5.16 Save Client Visit data Offline
Description: The Client Visit in offline mode stores information about the purpose of
their visit to the customer and type of visit for example meeting, conference, union
meeting, or online meeting etc in the task sheet table of the SQLite database in the
android phones.
~ 58 ~
5.2.17 List of Offline Visits
Figure 5.17 Lists of Offline Visits
Description: After saving the list of client visit details stored in the phone memory is
shown in the above activity.
~ 59 ~
CHAPTER - 6
TESTING
The chapter shows the various test cases.
~ 60 ~
6. TESTING
6.1 Software Testing
Software testing is the process of validating and verifying that a software
application meets the technical requirements which are involved in its design and
development. It is also used to uncover any defects/bugs that exist in the application.
It assures the quality of the software. There are many types of testing software viz.,
manual testing, unit testing, black box testing, performance testing, stress testing,
regression testing, white box testing etc. Among these performance testing and load
testing are the most important one for an android application and next sections deal
with some of these types.
6.2 Black box Testing
Black box testing treats the software as a "black box"—without any
knowledge of internal implementation. Black box testing methods include:
equivalence partitioning, boundary value analysis, all-pairs testing, fuzz testing,
model-based testing, traceability matrix, exploratory testing and specification-based
testing.
6.3 White box Testing
White box testing is when the tester has access to the internal data structures
and algorithms including the code that implement these.
6.4 Performance Testing
Performance testing is executed to determine how fast a system or sub-system
performs under a particular workload. It can also serve to validate and verify other
quality attributes of the system such as scalability, reliability and resource usage.
Figure 6-1 Performance Statistics
~ 61 ~
6.5 Load Testing
Load testing is primarily concerned with testing that can continue to operate
under specific load, whether that is large quantities of data or a large number of users.
6.6 Manual Testing
Manual Testing is the process of manually testing software for defects.
Functionality of this application is manually tested to ensure the correctness. Few
examples of test case for Manual Testing are discussed later in this chapter.
Test Case 1
Test Case Name
Description
Output
Empty login fields testing
In the login screen if the username and password fields are
empty
Login fails showing an alert box asking to enter username and
password.
Figure 6-1 Test Case for Empty Login Fields
~ 62 ~
Test Case 2
Test Case Name
Description
Output
Wrong login fields testing
A unique username and password are set by administrator. On
entering wrong username or password gives.
Login fails showing an alert box username or password
incorrect.
Figure 6-2 Test Case for Wrong Login Fields
~ 63 ~
Test Case 3
Test Case Name
Add to SQLite testing
Description
Entity code and Name are mandatory fields. If left empty.
Output
Insert Fails and a toast message appears asking to enter entity
code and name.
Figure 6-3 Add to SQLite Activity Testing
~ 64 ~
Test Case 4
Test Case Name
Inserting New Record
Description
Entity code and Name are mandatory fields. If all fields given.
Output
New Record Created
Figure 6-4 Test Case for Inserting New Record
~ 65 ~
6.7 Testing Tool
Testroid Recorder
Testdroid Recorder is a unique tool for recording user actions, generating
reusable Android JUnit test cases and running them in Testdroid Cloud.
Figure 6-5 Testroid Recorder
Figure 6-6 Testroid generated Test.java
~ 66 ~
CHAPTER - 7
RESULTS &CHALLENGES
The chapter describes the results and challenges faced in the project.
~ 67 ~
~ 68 ~
7. RESULTS AND CHALLENGES
7.1 Results
The current application is developed using Android framework and can be
used by the sales force to work with customer information from remote locations and
when you are not connected to a cellular or Wi-Fi network on their Android mobile
phones. This simple CRM allows you to easily capture information during or after
meetings and carry your customer data with you everywhere you go.
At the time of submission of my application was capable of doing the
following:

Displaying a welcome screen

Authentication of user by using login screen

Home screen to choose between online and offline mode.

Tabbed menu bar to switch between online, offline, home screen and recent
activity.

List, create, update, delete and download records from online mode.

Access data offline and sync changes.

Create, update, delete and sync records from offline mode.

Search for records offline in device.

Saving client visits in online and offline modes.

Logout and end the session.
7.2 Challenges

Understanding the client requirements was one of the crucial tasks of the
whole project.

Graphic User Interface (GUI) design was a difficult task as there are many
types of Android devices with varying screen size and resolutions unlike
iPhone.

Implementing synchronization with server on Android was a challenging task.

Learning different technologies and frameworks with little guidance.
~ 69 ~
CHAPTER - 8
CONCLUSIONS & FUTURE WORK
The chapter gives brief introduction of the project.
~ 70 ~
8. CONCLUSION
8.1 Conclusions
The application has been designed successfully to meet all the user
requirements. I found this project to be far more difficult than I ever anticipated.
Without doubt, this has been the most challenging and at the same time rewarding
programming project I have undertaken since I started college.
8.2 Scope for future work
The application can further be modified in the following ways:

Finish the implementation of syncing the client visit details to server.

Additional features like adding tasks, events can be implemented. .

Introduce a feature to call contacts directly from within the app.

Integrate with built-in Google Maps API, SMS, and Email.

Fix all existing bugs
8.3 Limitations
The current application stores data in the phone memory. If the phone memory
is insufficient to hold the database file i.e., when the file size is very large, a SD card
can be used. However, using an SD card is not a secure option; there is a possibility of
data being copied by other users. Additionally, there is a scope of data loss when the
card is removed or un mounted. Hence, we have used the phone memory to store the
data.
~ 71 ~
BIBLIOGRAPHY
Code snippets for Android development
http://stackoverflow.com/
Android Development Guide
http://developer.android.com
Rubin, A 2010. About the Android Open Source Project | Android Open Source
[Online]. Available from: http://source.android.com/about/index.html .
SQLite Home Page. 2011. SQLite Home Page. [ONLINE] Available at:
http://www.sqlite.com.
Connection between PHP and MySQl
http://www.androidhive.com
Software Testing
http://en.wikipedia.org/wiki/Software_testing
DDMS
http://developer.android.com/guide/developing/debugging/ddms.html
Manual Testing
http://en.wikipedia.org/wiki/Manual_testing
Performance Testing
http://en.wikipedia.org/wiki/Software_performance_testing
Android Tutorials
http://www.newboston.com
~ 72 ~