8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
1/87
1
Project Name
Byte Transfer – Transferring files + instant messagingbetween Android OS based devices over Wi-Fi
Prepared by:
spac3hit
This project is submitted in partial fulfillment of therequirements for the Bachelor of Science degree in Computer
and Information TechnologyJune, 2013
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
2/87
2
Table of ContentsAbbreviations .................................................................................................................................. 5
Acknowledgement ........................................................................................................................... 6
Abstract ........................................................................................................................................... 7Chapter 1 – Introduction ................................................................................................................. 8
1.1 Overview ................................................................................................................................ 8
1.2 Project Description ................................................................................................................ 8
1.2.1 Application Uses ............................................................................................................. 9
1.3 Project's Objectives ............................................................................................................... 9
1.4 Motivation ............................................................................................................................. 9
1.5 Project Scope ....................................................................................................................... 10
1.5.1 Deliverables .................................................................................................................. 10
1.5.2 System Constraints ....................................................................................................... 10
1.5.3 Development Language ................................................................................................ 10
Chapter 2 - Literature Review, Market Survey .............................................................................. 11
2.1 Android Overview ................................................................................................................ 11
2.1.1 Advantages of the Android OS ..................................................................................... 11
2.1.2 Android Interface ......................................................................................................... 11
2.1.3 Android Google Play Store ........................................................................................... 12
2.1.4 Security ......................................................................................................................... 12
2.1.5 File System .................................................................................................................... 12
2.1.6 Android Architecture .................................................................................................... 12
2.2 The Project's Base Technology ............................................................................................ 15
2.3 Market Survey ..................................................................................................................... 18
2.4 SQLite Overview .................................................................................................................. 21
Chapter 3 - Project Management Plan .......................................................................................... 23
3.1 Risks Analysis ....................................................................................................................... 23
3.1.1 Requirement Risks ........................................................................................................ 23
3.1.2Technology Risks ........................................................................................................... 23
3.1.3 Staff Turnover ............................................................................................................... 23
3.2 Project Resources and Total Estimated Cost ....................................................................... 24
3.2.1 Human Resources ......................................................................................................... 24
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
3/87
3
3.2.2 Hardware Resources ..................................................................................................... 24
3.2.3 Software Resources ...................................................................................................... 24
3.2.4 Hardware Cost .............................................................................................................. 25
3.2.5 Software Cost ............................................................................................................... 25
3.2.6 Task Set ......................................................................................................................... 25
Chapter 4 - Software Requirement Specification .......................................................................... 26
4.1 Use Case Diagram ................................................................................................................ 26
4.2 Requirement Description as Scenarios ................................................................................ 27
4.3 Activity Diagrams ................................................................................................................. 43
Chapter 5 - Software Design Description (SDD) ............................................................................ 44
5.1 Relational Model ................................................................................................................. 45
5.2 Sequence Diagrams ............................................................................................................. 465.3 Class and Object Design....................................................................................................... 47
5.4 User Interface Design .......................................................................................................... 48
Chapter 6 - Implementation .......................................................................................................... 49
6.1 Activities .............................................................................................................................. 49
6.2 Android Manifest ................................................................................................................. 49
6.3 SQLite ................................................................................................................................... 51
6.4 Views ................................................................................................................................... 52
6.5 Android Package .................................................................................................................. 53
6.6 Publishing on the Market .................................................................................................... 54
Chapter 7 – Testing Documentation ............................................................................................. 55
7.1 Testing Approach ................................................................................................................. 55
7.2 Testing Plan ......................................................................................................................... 55
7.2.1 Unit Testing ...................................................................................................................... 55
7.2.2 Integration Testing ........................................................................................................... 56
Chapter 8 – Summary and Conclusion .......................................................................................... 578.1 Conclusion ........................................................................................................................... 57
8.2 Future Work ........................................................................................................................ 57
Appendix ‘A’ – Activity Diagrams .................................................................................................. 58
Appendix ‘C’ – Source Code........................................................................................................... 81
Bibliography ................................................................................................................................... 87
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
4/87
4
Table of figures
Figure 1 - Android Architecture ..................................................................................................... 12Figure 3 - Libraries ......................................................................................................................... 13Figure 2 - Linux Kernel ................................................................................................................... 13
Figure 5 - Application Framework ................................................................................................. 14Figure 6 - Activity Lifecycle ............................................................................................................ 14Figure 4 - Android Runtime ........................................................................................................... 14Figure 7 - Applications Layer ......................................................................................................... 15Figure 8 - TCP/IP Model Layers ...................................................................................................... 15Figure 9 - TCP Connection between Client& Server ...................................................................... 17Figure 10 - Market Share, Q3 2012 (IDC) ...................................................................................... 20Figure 11 - Class Diagram .............................................................................................................. 26Figure 12 - Send File Activity Diagram ........................................................................................... 43Figure 13 - Select Context Activity Diagram .................................................................................. 44
Figure 14 - ER Diagram .................................................................................................................. 45Figure 15 - Send File Sequence Diagram ....................................................................................... 46Figure 16 - Select Context Sequence Diagram .............................................................................. 46Figure 17 - Class Diagram .............................................................................................................. 47
http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076844http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076847http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076850http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076851http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076852http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076855http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076856http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076857http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076858http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076858http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076857http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076856http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076855http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076852http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076851http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076850http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076847http://c/Users/czone/Desktop/Complete%20Report%20(sent%20by%20supervisor%2026-1-2013).docx%23_Toc347076844
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
5/87
5
Abbreviations
Wi-Fi: Wireless Fidelity
NDK: Native Development Kit
SDK: Software Development Kit
ADT: Android Development Tools
TCP: Transport Control Protocol
UDP: User Datagram Protocol
NFC: Near Field Communication
IDC: International Data Corporation
SQL: Structured Query Language
IP: Internet Protocol
JVM: Java Virtual Machine
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
6/87
6
Acknowledgement
First and foremost, I would like to thank ‘God’ who g ave me the power to pursue mygoals. I could never done this without the faith I have in you, the Almighty.
I take immense pleasure to express my sincere and deep sense of gratitude to my parentsfor their unceasing encouragement and support.
I also thank my supervisor for his sustained enthusiasm and for his motivation and hiscreative ideas.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
7/87
7
Abstract
Wi-Fi is widely spread in organizations, restaurants and public spaces and there is a needfor transferring images, Videos, and other types of files over Wi-Fi between friends andcolleagues. This project aims to solve the problem of transferring files between AndroidOS based devices over Wi-Fi.
The solution is to develop an Android Application, called "ByteTransfer", for transferringfiles between Android OS based devices over Wi-Fi, without the need to access theinternet. The application will target general Android based devices users with Wi-Fiability. The Application is developed over the TCP protocol which will be discussed in
chapter 2.
Another uses for this application is targeted for educational purposes as well which I will be discussing it in the next chapter.
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
8/87
8
Chapter 1 – Introduction
1.1 Overview
With the wide spread of smart phones starting since 2007, when the first iPhone wasintroduced, and the introduction of Android OS afterward, the need for mobile phoneapplications that users would like to have has increased remarkably and the developmentof mobile applications had spread through different organizations and companies.
Cellular phones had become smart phones that are capable of handling many operations.And one of the major applications that a user would like to have in his handheld device isan application that allows him or her to transfer files and have conversations over Wi-Fiwith friends, colleagues and family without the need for cables or installing drivers or
any such boring operations. Nowadays, many applications are available for transferring files over Wi-Fi. Chapter twowill briefly describe some of the major applications in this field. However, all theseapplications use HTTP protocol, and the file transfer happen between the Android deviceand the user's workstation (PC, Notebook) with the assistant of a pre-designed webpage.Hence, developing this application will allow users to directly transfer files betweenAndroid devices and have conversations from one smart phone to another over Wi-Fiwithout the need of any extra platform.
Another important thing, many other technologies exist there for this purpose; like Wi-FiDirect, Near Field Communication (NFC) and Bluetooth, These all technologies have thesame purpose, but not all are available or supported in all devices such as the NFC andthe Wi-Fi Direct, and some are relatively slow in transmitting data such as the Bluetooth.Hence, there is a necessity to develop an application that has the same purpose and isavailable to Android users and can support high transfer rates.
1.2 Project Description
This project aims to deliver to Android users an effective application that saves effort andmoney by not requiring the user to buy the latest device that has for example NFCtechnology to be able to transfer file at high data rates. Hence, this application can useany available Wi-Fi Access Point. This application will be released on Google Play freeof charge for Android users.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
9/87
9
1.2.1 Application Uses
For regular users who would want to share files or have a chat in any place with aWi-Fi connection.
For educational purposes, at schools or colleges. The idea behind this applicationcomes from the fact that mobile devices and tablets are spread all over the world.
Nowadays students in some countries, for example south Korea, are going toschools with tablets and iPads rather that a "book-crowded bag". Added on thatsouth Korea, for example, is looking forward to convert all text books into digitalones by 2015, allowing the students to hand held just the tablet. Hence, for thiseducational use, a client version of the Android application will be released forstudents and a server version for the teacher at a school or the lecturer at acollege, allowing the user of the server version to take control of the clientdevices in order to organize and strict the files transferred between devices.
1.3 Project's Objectives
To provide a dual use in real life, one for regular users and the other foreducational purposes.
To provide an application that is available to Android users without therequirement of additional technologies or effort.
To guarantee high speed data transfer between devices because the Wi-Fi is usedas the transfer medium.
To bring an effective free of cost application for Android users. To provide an operable application everywhere, anytime over Wi-Fi connection.
1.4 Motivation
The selection of this project was in the first place to get involved in the rapidly growingmobile development world as it is growing exaggeratedly, and as smart phones arespreading insanely all over the world.
I have an excellent background and experience in the Java programming language that isused in the Android applications development and my summer training was over mobiledevelopment. I am also aiming forward to sharpen my skills and techniques and todeepen my knowledge in the field of mobile development, especially for Androiddevices.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
10/87
10
1.5 Project Scope
1.5.1 Deliverables
ByteTransfer application operable on any available Wi-Fi Access Point,anywhere.
Is capable of transferring any file size to another device. The system is deliverable for any Android based smart phone that has an Android
OS version 2.2 or later. Users ability to search files from the device's file system to send. SQLite database to save logs. Users will be able to fetch logs. The application will automatically adapt its interface to the screen size of the
device installed on.
1.5.2 System Constraints
The application is intended to be built for Android OS based devices only. Wi-Fi network has to be available for the two devices to be able to communicate.
1.5.3 Development Language
ByteTransfer application will be developed using the Java language being the soledevelopment language for Android applications. Mentioning here that an Android NativeDevelopment Kit (NDK) is available for developers who would like developing in C/C++to do some CPU or memory allocation operations. C language is not used in mostAndroid apps.
The rest of this report goes like this; Chapter 2 presents a description of the technologies
involved in the development of this project and will present some market analysis. InChapter 3, risk analysis is provided along with the project's resources and the tasksscheduled on the timetable. Chapter 4 will define the software (application) requirementspecification (SRS) by setting the use cases, there typical course of events and also theactivity diagram . And then Chapter 5 which will describe the software design with thedifferent diagrams; Entity Relationship (ER) diagram, Sequence diagrams, Class diagramand an abstract view of the Graphical User Interface (GUI).
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
11/87
11
Chapter 2 - Literature Review, Market Survey
This chapter provides an overview of the Android operating system, and explains theAndroid Architecture. Later, the chapter describes the technologies that this applicationwill use as it will explain the TCP Protocol Structure. Afterwards, the most importantsimilar applications will be analyzed and the Android OS Market Share will be depicted.The chapter finished with an overview of the SQLite data base that will be used to recordlogs for the application.
2.1 Android Overview
Basically Android is an operating system for mobile devices, a small company started
developing it, to be the first operating system for mobile devices built on the LinuxKernel. But later in 2005, Google had bought the Android project along with Theestablishment of the Open Handset Alliance (OHA) led by Google, which comprise manyhuge companies like LG, Samsung Google and more whom its goal was to set standardsfor mobile devices and build better phones for consumers (just for Android).
2.1.1 Advantages of the Android OS Android was based on Linux, which means stability and reliability.
Android is an open source platform, which lets the developers to gain access to theAndroid OS's resources and afford the developers a high flexibility in developing apps.Added on that now every company like Samsung, LG, HTC and Motorola differentiatein manipulating the Android OS in its properties, layout, interface and special featuresto produce Android based devices in its core having the company’s special touches, thatgives the users a range of options to choose. (It may be considered a disadvantage forthe developers because of the large number of devices are in the market).
The integration with Google Services, Google has written specific apps forsynchronizing the user's data on the device with their google account. Some of it is the
Contacts, Addresses, Youtube history, gmail , notes calendar and more.
2.1.2 Android InterfaceInterface basically depends on the 3D desktop which is the user's main workspace whichallows users to add apps shortcuts and widgets - which is a simple and easy embeddedapp- . One of the remarkable features also is the high sensitive touch screen whichsupports multi-touch technology.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
12/87
12
2.1.3 Android Google Play StoreIt’s included in every version of Android OS, the Apps Play Store, previously AndroidMarket, which lets the user to search and download apps, free and paid ones. Accordingto October, 2012 statistics the store is consist of more than 700K applications withdifferent categories. And Google doesn't restrict the user to download just from its storelike other companies are, but the user has the choice to download apps from any store helike. One of the famous android apps market is SlideMe.
2.1.4 SecurityEvery Android app has its own sandbox that contains a file system, preferences anddatabase. This ensures preventing the access of the app resources without permissions.
2.1.5 File SystemIn Android the file system has three contexts; one for the System, one for Apps whichmounted in /data/data/com.application_name, and one for everything, that is, the sdcard,
and is used for storing music, photos, videos, downloaded files, etc ... .2.1.6 Android Architecture
Figure 1 - Android Architecture
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
13/87
13
First Layer: Linux Kernel
It is the core of the android OS. Android use the Linux kernel 2.6 to manage main processes including security, memory management and different device's hardwaredrivers. It's the linking point between the Android OS and the device it is operating on.
Second Layer: Libraries
Figure 3 - Libraries
Android OS includes many C/C++ libraries for handling different types of data.
Some of these libraries are:
Media Framework: Which deals with most codec media formats for video, audio andimages, e.g. MP3, MP4, 3GP, MPEG4, JPEG and more.
LibWeb core: This library is used as the browser engine to render HTML content.
Surface Manager: Composing the windows layer in the framework layer with the off-screen buffering, which means when the user draw something on the screen theWindow Manager in the Application Framework takes these parameters, combine itwith some graphic libraries in the off-screen then forms the final screen the user see.
SQLite: a special library for managing databases in the Android OS. (The databaseengine)
Figure 2 - Linux Kernel
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
14/87
14
Android Runtime
Which consist of Dalvik VMachine and the Java CoreLibraries.
Dalvik Virtual Machine (type of Java Virtual Machine(JVM)): Every application runs in the Android OSruns as a process and has its own virtual machine.
Normally programs written in Java are converted to bytecode then to JVM [xxx.classfile], unlike JVM, Dalvik VM runs [xxx.dex] file (Dalvik executable file) rather than[xxx.class] file, which is build during the compilation process from the [xxx.class] filethen zipped in [xxx.apk] file, this for more efficiency in low resource environments(memory and processor). This provides security and isolation of each app from another.It's a 16-bit instruction stack, which makes the interpreter faster.
Third Layer: Application Framework
Figure 5 - Application Framework
Developers could utilize all the device's properties to build special applications to benefits from the resources or run a process in the background, or adding notifications inthe notification bar and more. Application Frameworks was developed to be easy to reusein other applications.
Some blocks of the Application Framework:
Activity Manager: Manages the activity lifecycle of an application
Figure 6 - Activity Lifecycle
Figure 4 - Android Runtime
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
15/87
15
Content Provider: Allow sharing data between apps/activities .
View System: Which consists of a large number of views that builds the application's
interface along with the help of the XML that defines these views. e.g. GroupBoxes,TextFields etc ... .
Notification Manager: Allows app to display notifications in the system's notifications bar.
Fourth Layer: Applications
Figure 7 - Applications Layer
It is the last layer in the Android architecture which consists in the first place applicationsthat natively come installed with the Android OS, e.g. Phone, Contacts, Settings andmore. In the second place comes the applications that are written by developers, arewritten in Java.
2.2 The Project's Base Technology
Figure 8 - TCP/IP Model Layers
In Java networking data is being transferred over network through the TCP/IP modellayers. Java introduces a set of classes that are responsible of handling connections anddata transfer over the network. On the Transport Layer, UDP and TCP protocols are there
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
16/87
16
to implement this approach. Each of the TCP and UDP protocols has its own properties, pros and cons.
UDP which stands for User Datagram Protocol can transfer messages (data bytes) asdatagrams and without sophisticated order, in the headers of a datagram there is a Time
To Live Header (TTL), a datagram is routed to different routes to reach its destination,and if it doesn't reach it increases by one, if it reached the maximum TTL value it's beingignored, it is non-handshaking dialogue thus it is not reliable and delivery of data is notguaranteed.
TCP protocol is a hand-shaking way of data transportation, thus delivery of data isguaranteed to the other side, but its slower than the UDP Protocol as it has more work todo and processes that guarantees delivery of the data to destination. It eliminateswhimsically order of data and packet loss the UDP protocol has, and it abbreviates extrawork in the first place for the developers who need to guarantee delivery of data to
destination.
This project uses the TCP as the transportation protocol, this resides on the TransportLayer. An Android application will be developed for handling communication betweendevices and sending files mainly. Client-Server paradigm is implemented, i.e. A serverapplication that acts as the server where a specified port [ >= 1,024 to 65,535] is set to itto be identified by the applications on the clients' devices, and a client application thatacts as the client, where it opens a connection with the server side app through specifyingthe IP Address of the server and the port number that identifies the application. These twoapps reside on the Application Layer.
The IP is used as the physical transferring medium which is resides in the Internet Layer.And the Wi-Fi is used as the Physical Layer.
TCP Structure
TCP uses lower-level communications protocol, the IP, to establish connection betweenthe client and the server. The connection allows a stream of bytes to be sent and receivedand it converts the bytes sent to IP Datagrams somehow.
TCP handles a vital task, i.e. Multiplexing/Demultiplexing, through the use of sockets
which binds a port to an application. This task is used to put information arriving in parallel in order.
There is a bunch of headers that a TCP segment contains along with the data including:
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
17/87
17
SYN Flag - is set to 1 when synchronizing between client and server (whenstarting the connection)
ACK Flag - is set to 1 when acknowledging a packet. FIN Flag - if set to 1, then the connection is terminated. Sequence # - flag shared with client and server that indicates the offset of the data
sent. Data - the actual sequence of bytes.
Demonstration Of TCP Connection Between Client and Server
TCP three way handshaking techniquestages for establishing a connection:
First Stage: When the client attempts to establish a connection, the SYN header isset to 1 to tell the server it's a synchronization segment and an initial number for
the sequence number header.
Second Stage: The server receives this segment from the client, and sends theclient a synchronized segment where the SYN and the ACK is also set to 1
because it's a synchronization segment. The ACK number value is equal to the previous sequence number to acknowledge that the last segment is receipted. Andit contains the sequence number for the Server machine, which is the initialsequence number for the client.
Third Stage: in this stage the client sends a segment containing the ACK that is
set to 1 and SYN that is set to 0, because it's no more a synchronization. Theclient's sequence number is incremented by 1 and ACK that contains the serverslatest sequence number to acknowledge the segment.
Whenever a segment is sent from either nodes, a timer that is set to a specific timestarts, if an acknowledgment is sent from the other node the timer stopped, but ifnot and the timer ends, the node retransmits the segment.
Figure 9 - TCP Connection between Client& Server
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
18/87
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
19/87
19
This solution supports a wide range of platforms including Android, iOS,Windows, Mac OSX. Transferring files is done along with a server andinternet connection.
o Synchronized file system between devices including computers, laptops
and mobile phones. This methodology achieved by saving all thedesired files on the Drop Box servers, so if all the devices that holds theseshared files ruined, the user could still have access to his files he hadshared.
o Rating on Google Store: 4.6 Stars according to 144,653 Raters.
o Cost: Free for all platforms.
o Last 30 days (From Oct 14, 2012), more than 10Mil downloaded andinstalled.
Third: Microsoft's SkyDrive
o Cloud Solution
o Storing files and accessing them from any browser including Chrome,IE10 and Firefox and support for Android iPhone and Windows Phoneoperating systems.
o Cost: Free for 7GB, and 10 bucks a year for 20GB
o Rating on Google Store for Android users only: 4.4 stars according to4,248 Raters.
o Until Oct 14, 2012 about 1Mil downloads.
Fifth: Apple's iCloud
o Apple's cloud storage solution uses its enormous data center in NorthCarolina for storing users data (Keynote, Pages and Numbers Documents,
Apps, Contacts, Music, and Pictures). Support only for iDevices and appleusers.
o Over 125 Million users according to 24 April, 2012 statistics.
Sixth: WiFi Transfer Pro
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
20/87
20
o Transferring files to and from Android phones to computers using a browser through the implementation of HTTP protocol.
o Size 464 K
o Cost: Free
o Rating on Google Store: according to 4,028 Raters.
o Until Oct 14, 2012 over 1Mil downloads.
Seventh: Kies air
Developed by Samsung Electronics and comes installed on Samsung Galaxy Products.Kier air uses HTTP protocol for communication, it creates a web server on the Androiddevice and allows users from the same Wi Fi to access this server using any browser.Kies air categorizes files into photos, music and video and allows access to messages,contacts and other device information.
o Size: 9.9MB
o Cost: Free
o Downloads: More than 10,000,000
o Android Versions: 2.2 - 4.1
o Rating on Google Play: 4.3 based on 57,212 votes.
And other applications that uses similar methodologies and technologies but has differentfunctionalities and GUIs like ES File Explorer Manager developed by EStrongs Inc.,FileExpert developed by Geek Software Technology Inc. .
Android Market Share by 2012
Figure 10 - Market Share, Q3 2012 (IDC)
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
21/87
21
According to the International Data Corporation (IDC) by quarter 3 (Q3) of 2012Android gains as 75.0% of the worldwide mobile market share as smart phones operatingsystem. 181.1 million shipment during this quarter (Q3), android has 136 million of it,
and 31% - 35% of it is for Samsung. Samsung in this quarter sold 56.3 million units ofSamsung S3, where apple sold just 26.9 million iPhones including iPhone 4S and iPhone5.
Android nowadays is considered the most spread system for 500 million devicesactivated and 1.3 million device activated every day.
2.4 SQLite Overview
SQLite is a small embedded database and is a part of the operating system. Since it islight, it does not consume the memory and the processor resources of the mobile phone.The database is used in almost every operation system from desktop operating systems tomobile operation systems.
Pros:
Light in size.
Simple installation.
Supports SQL92 standards which includes ACID properties [Atomicity,Consistency, Isolation, Durability].
Cons:
Database maximum size is 140 Terabytes, whereas the maximum size of theOracle database for example is about 7 Petabytes.
The maximum number of rows are limited in SQLite, whereas in Oracle databasefor example its unlimited.
Just one user can access the database at one period of time.
In spite of the limitations of the SQLite, our application does not require more than theSQlite features and will never come near the boundaries of the SQLite.
Examples:
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
22/87
22
o Firefox uses SQLite embedded database to store cookies, cache andhistory on the user's computer, here it is an excellent choice becausehaving the user a MySQL database or other databases is not guaranteed.
o In iPhone iOS SQLite database is used to store phone calls' logs and SMSs
on the user's iPhone.
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
23/87
23
Chapter 3 - Project Management Plan
In this chapter, the project management plan is specified by
Identifying the risks that may occur during the development of this project byimplementing the proactive strategy.
Identifying the resources that are utilized while developing this project.
Setting tasks on schedule using Gantt Chart timetable.
3.1 Risks Analysis
Every software project may be plagued by problems and risks that may affect theviability of the project.
3.1.1 Requirement RisksGold Plating, One of the causes that may put the project in risk exposition, that is, thedevelopers may be very enthusiastic when starting off the project, so they may set farrequirements that they will not achieve within the project's schedule. So for this systemconstraints and project requirements defined in chapters 1 and 4 which specify exactlywhat the system functions are. Requirements have to conform to the constraints of the
system and have to be well specified before beginning the design phase when using thelinear sequential approach. New requirements arise in the design or implementation phasewill delay the project's submission and cost extra money.
3.1.2Technology RisksA project may face some risks concerning the technology field this project is going totake place in and developed by. The project manager have to be acquainted with the
project's technologies, and if some new technologies are introduced he should adjust the project's budget and schedule accordingly.
Here, in my project, extra time is specialized to study the Android developmentenvironment and the TCP protocol the application's structure rely on.
3.1.3 Staff TurnoverIn almost every IT company members of project's team may withdraw from it because ofsome reasons, this member may know a rare technology , therefore project managershould take in considerations that this could happen so one of the proactive strategyactions is to teach other project team members this technology so to have backup plan if
problems occur and to guarantee the project's lifecycle continuity.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
24/87
24
3.2 Project Resources and Total Estimated Cost
For this project to be completed, some resources are vital to be available, these resourcesare reviewed below.
3.2.1 Human Resources System Analyst
System Designer
System Programmer
The project's team consist of one member, so I take the responsibility of completing allthe above human resources related tasks.
3.2.2 Hardware Resources A Workstation consolidated with 800 MHz CPU --> 1.5 GHz is recommended.
512 MB of RAM memory --> 1 GB is recommended.
300 MB of disk space --> 1 GB is recommended.
Android OS based smart phone, mentioning here that Google has a development sere phones (Nexus).
Micro USB connectivity cables.
3.2.3 Software Resources Mac OS X 10 or Windows XP or later.
Eclipse IDE Juno version.
Android Software Development Kit (SDK), Application Programming Interface (API)level 8, version 2.2 .
Android Development Tools (ADT) for Eclipse IDE.
Android development account for distributing the application on the Google PlayStore.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
25/87
25
3.2.4 Hardware Cost Workstation: 2000 NIS
Smart Phone: 1000 NIS
3.2.5 Software CostAll software development tools are available for free except for the Android DeveloperAccount which costs 25$ one time registration fee.
3.2.6 Task SetThis is a 32 week one man project, as I, spac3hit , is the only member in the project'steam. If more human resources are dedicated to work in the project the duration willdecrease and tasks will be done faster.
In Appendices attached the Gannt Chart that contains tasks schedule.
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
26/87
26
Chapter 4 - Software Requirement Specification
In this chapter a Use Case diagram that describes the interactions between actors anddifferent system components is provided, then the Functional and requirements aredescribed in the use cases' typical course of events, also an Activity Diagram thatillustrates the process of sending a file from one user to another throw an openedconnection, how to open a connection between two devices is explained exhaustedly inthe uses cases typical course of events. All other activity diagrams are attach in theappendixes.
4.1 Use Case Diagram
Figure 11 - Class Diagram
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
27/87
27
4.2 Requirement Description as Scenarios
Use Case: Select Context
Use Case ID: UC1
Actors: User
Purpose: User can select what context his application will be, a client or a server.
Typical Course Of Events:
Actor System Response
1. User opens the application. 2. The application interface appears to the user.
3. The user selects whether to be the clientor
the server.4. If Client Selected, System shows up the client
Interface for the user.
4. If server selected, System shows up the serverinterface for the user.
5. Communicate Panel opens [UC5]
Alternative Course Of Events:
Line3: if both users select the same context, they will not be able to communicate =>Step #1 .
(Hint: At step 4, if either choices is selected, on the other device the opposite choiceassumed to be selected.)
Use Case: Check Port
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
28/87
28
Use Case ID: UC2
Actors: User
Purpose: Server User checks a specific port to see if available.
Typical Course Of Events:
Actor System Response
1. Server User enters a port number that isequal or more than 1024 (=>1024).
3. System checks the validity of the port number
to ensure the number entered is equal or morethan 1024.
2. Server User Hits on the Check PortButton
3.1 If port is valid, then check if it's not bind toanother app or service.
3.1.1 If not bind, then send the Server User a portapproved and opened message.
3.2 If port is not valid ( Step # 3.2, Step #1 .
Line 3.1.1: if port is bind to another app => Step #3.2, Step #1 .
Use Case: Open Port
Use Case ID: UC3
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
29/87
29
Actors: Server User
Purpose: Server User opens a port for the Client User to let him connect to it.
Typical Course Of Events:
Actor System Response
1. After a valid port server, Server Userhits on Open Port to open theServerSocket. 2. System opens the ServerSocket with the port
the Server User had specified previously.
3. Server then is ready, port is set up.
4. Server User side app now is listening forclients (incoming connections, [UC4])
Alternative Course Of Events:
Line 4 : No incoming connections => Step #4
Use Case: Listen For Clients
Use Case ID: UC4
Actors: System (ServerSocket), Client User, Server User.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
30/87
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
31/87
31
Purpose: To determine the type of communication between devices, Instant Messaging(IM) or File Transfer (FT).
Typical Course Of Events:Client User Server User
When either users selects an option of IM or FT, the other user will be informed about what theother user had select.
1. Client User selects IM
2. Server User is informed about what the ClientUser has selected.
3. System will prevent the Server User from selecting the FT option, rather will force him toselect the IM option, this, for both devices to be option synchronized.
4. IM Screen appears on both devices
Alternative Course Of Events:
Line 1: Client User selects the FT option => Step #2 through Step #4, but FT is usedinstead of IM.
Use Case: Establish Connection
Use Case ID: UC6
Actors: Client User, System (Socket), Server User.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
32/87
32
Purpose: Client User establishes connection with the Server User through creating aSocket with the port the Server User has assigned previously.
Typical Course Of Events:Client User Server User System Response
1. Client User enters the port theServer User previouslyassigned to connect to theserver user, and hits on theconnect button [UC7]
2. Server User receives a pending approval messagefor accepting the connectionor not [UC4]
3. System creates the connection(Socket) with the port theServer User opened.
2.1 Server User approves theconnection [UC4, Step 4]
4. Server User System accepts
the connection 5. Communicate Screen opens for both devices
Alternative Course Of Events:
Line 1: Port is not available => Step #1, Enter Port [UC7] .
Line 2.1 : Server User denies the connection => Step #1, Enter Port [UC7] .
Use Case: Enter Port
Use Case ID: UC7
Actors: Client User
Purpose: Client User enters a port to connect to the Server User.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
33/87
33
Typical Course Of Events:
Actor System Response
1. Enters port number Server User has previously opened.
Alternative Course Of Events:
Line 1: Port not available => Step #1 .
Use Case: Connect To Wi-Fi
Use Case ID: UC8
Actors: User, Wi-Fi Access Point (AP)
Purpose: User connects to Wi-Fi and receives an IP Address, for the app to use forcommunicating with the other device.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
34/87
34
Typical Course Of Events:
Actor WI-Fi AP
1. User enters the system settings
6. Wi-Fi AP verifies the password.
2. Navigates to reach the Wi-Fi settings.
3. Ensures that the Wi-Fi is running.
4. Chooses the desired network to connectto.
5. If password is required, User enters password.
7. Connects the User to the network andassigning him an IP Address.
Alternative Course Of Events:
Line 6: Incorrect password => Step 5 .
Use Case: Send File
Use Case ID: UC9
Actors: First User (source), Second User (destination).
Purpose: User (source) Selects file from list to be sent to the second User (destination).
Typical Course Of Events:
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
35/87
35
User (source) System Response User (destination)
1. User selects the file desired to be sent.
2. Application asks the user ifhe would like to continueon sending this file.
4.1 User approves.
3. User approves 4. System sends aconfirmation message forthe destined device andwaits for approval
5. System encrypts data andgoes into sending the file.
6. User receives the file andconfirmation message is sent tothe User (source).
7. User receives a File Sentconfirmation message.
8. File sent information log issaved in the SQLite
database on both devices.
9. System goes back to theFile Transfer communicatescreen.
Alternative Course Of Events:
Line 4: User (destination) doesn't confirms to receive the file => prompt user a message
nad goes back to Step #9 .Line 2: User (source) doesn't confirm to continue on sending the selected file => Step #9 .
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
36/87
36
Use Case: Receive File
Use Case ID: UC10
Actors: User (destination), User (source).
Purpose: User (destination) receives file From the User (source).
Typical Course Of Events:
Actor System Response
1. User (destination) receives a messagefrom the User (source) for approvingthe sending process.
3. System encrypts the Data and begins to deliverthe file to the User (destination) [UC9, Step 5]
2. User accepts the sending process[UC11].
4. User (destination) receives the file,and after decrypting user saves it tothe desired place.
5. System returns to the File Transfer
communicate screen.
4.1 User (destination) sends a FileTransferred confirmation message tothe User (source).
6. File sent information log is saved in the SQLitedatabase on both devices.
Alternative Course Of Events:
Line 2: User (destination) doesn't approves to receive this file => Step #5, and a denialmessage for the User (source) is sent.
________________________________________________________________________
Use Case: Accept File
Use Case ID: UC11
Actors: User (destination)
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
37/87
37
Purpose: User accepts or denies to receive file.
Typical Course Of Events:
Actor System Response
2. User (destination) accepts.
1. User(destination) receives a confirmationmessage from the User (source)
3. File transfer Begins.
Alternative Course Of Events:
Line 2: User (destination) denied the file transfer => UC4, Step #5 .
________________________________________________________________________
Use Case: Search File
Use Case ID: UC12
Actors: User, Internal Storage
Purpose: User can search for a specific file in the internal storage.
Typical Course Of Events:
Actor System Response
1. User taps on the search area to beginsearching process
3. System retrieves the files from the internalstorage that conform with letters the User had
2. User enters his desired name of file tosearch and hits on search button.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
38/87
38
enter, and show them on the screen for theUser.
4. User selects the desired file to send it[UC9] .
Alternative Course Of Events:
Line 3: System couldn't find the searched file name that the user requested => UC9, Step#9 .
________________________________________________________________________
Use Case: Send Message
Use Case ID: UC13
Actors: User (source), User (destination).
Purpose: User(source) can send messages to the User(destination) through the InstantMessaging Communication.
Typical Course Of Events:User (source) System Response User (destination)
1. Client User establishesconnection [UC6]
2. Application openscommunicate screen [UC5]
6.User (destination) receivesthe message, decrypt it and
3. User chooses InstantMessaging [UC4, Step #5]
4. Application opens InstantMessaging Communicationscreen [UC5, Step #4] .
5. User writes the desiredmessage in the dedicated area.
5.1 System encrypts themessage and send it.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
39/87
39
7. System save the messagewith its info in the SQLiteDatabase on both devices.
appears in the message logview.
________________________________________________________________________
Use Case: Receive Message
Use Case ID: UC14
Actors: User (source), User(destination)
Purpose: User (destination) receives a message from the User(destination) .
Typical Course Of Events:
User (Source) User (destination)
2. User (destination) receives the message,message appears on the message logeview and save to the SQLite Database.
1. User (destination) sends a message to theUser(source) .
________________________________________________________________________
Use Case: View History
Use Case ID: UC15
Actors: User, SQLite Database.
Purpose: User can go back to his previous messages history, and also can see the logs ofrecent files sent or received.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
40/87
40
Typical Course Of Events:
User System Response & SQLite Database
1. User at any screen hits the menu key. 2. Application shows up the menu contents.
3. User chooses to view history.
4. Application opens the history screen for theuser.
5. User chooses what history he wants toview (Instant Messaging history or FileTransfer history)
6. SQLite Database retrieves the entriesrequested, then system displays the dataretrieved on a separate screen.
________________________________________________________________________
Use Case: Close Connection
Use Case ID: UC16
Actors: Client User, Server User.
Purpose: User can close connection with other users.
Typical Course Of Events:
Client User System Response Server User
1. User opens the menu andchooses to closeconnection. 1.1 A confirmation message
appears to the user.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
41/87
41
1.2 User confirms
2. System closes connection between the Client User andthe Server User.
3. User returns to the Select Context screen
[UC1] . (Client User and Server User).
Alternative Course Of Events:
Line 1.2 : User doesn't confirm closing connections => return to communicate screen[UC5, Step #1]
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
42/87
42
Use Case : Check Wi-Fi Connection
Use Case ID: UC 8
Actors: User, Network Communication, Application.
Purpose: Check if user is connected to a Wi-Fi network and if not ask him to connect.
Typical Course Of Events:
Actor System Response1. User opens the application 2. Checks if connected to Wi-Fi
3. If connected continue to the select context
screen. [UC 1]4. If not connected ask user to connect to a Wi-Finetwork.
________________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
43/87
43
4.3 Activity Diagrams*Complete Activity Diagrams are attached in Appendix ‘A’
Figure 12 - Send File Activity Diagram
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
44/87
44
Figure 13 - Select Context Activity Diagram
______________________________________________________________________________
Chapter 5 - Software Design Description (SDD)
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
45/87
45
This chapter introduces different UML and database diagrams. These diagramsthoroughly illustrate the requirements that had been defined for the system in chapter 4.These diagrams and models will then facilitate the implementation phase.
5.1 Relational Model
Entity Relationship Diagram (ERD) is modeled to express the relations between differententities in the system's database, also for showing how data is physically stored in thedatabase.
In this project the database is used for saving logs about recently sent and received filesand messages between devices.
igure 14 - ER Diagram
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
46/87
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
47/87
47
5.3 Class and Object Design
Class diagram depicts the hierarchy of classes that creates the system along with therelations between these classes.
Class diagram is shown below. (functionality of each class will be provided nextsemester)
Figure 17 - Class Diagram
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
48/87
48
5.4 User Interface Design
Abstract view of the application's user interface is attached in the appendix, differentscreens' Activities are shown.
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
49/87
49
Chapter 6 - Implementation
This chapter will provide demonstration of how the application was implemented. With
the commitment with the disciplines -mentioned in Software Requirement Spesification
and Software Design Description chapters- a snippet codes are provided in this chapter
illustrating the main functions and properties of the application along with the
applicat ion’s interface (XML) codes. Some of the source code main functions are
provided in the appendices (Appendix C).
6.1 Activities
Every screen in Android that the user interact with is called an (Activity). Activity of an
application is a class that extends the activity class. The Activity creates a window for the
developer to write in the layout (XML) and java codes. The layout that the user sees on
the screen is connected with java through the activity with the function
[setContentView(R.layout. layout_id );] which takes an integer that represents the ID of
the XML layout file.
Example: The activity InstantMessagingActivity has a Java class called
(InstantMessagingActivity) and a XML layout file called
(activity_main_byte_transfer.xml), and the activity is connected to the layout using this
line of code: [setContentView(R.layout. activity_main_byte_transfer.xml );]
6.2 Android Manifest
Every application should have a file called [AndroidManifest.xml] in its root. This file
provides vital information about the application for the Android system It operates on.
Some of the tags in ByteTransfer Application’s AndroidManifest.xml file:
tag: which declares permissions from within the application to tell
the Android system that the application will use some protected parts of the system.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
50/87
50
ByteTransfer App’s permissions:
1. [Permission to use
the internet]
2.
[Permission to use the network]
3.
[Permission to use the Wi-Fi]
4. [Permission to
use the bluetooth]
5. [Permission to use the storage]
tag:
Provide the Android system an information about what versions of Android OS can run
this app (Min & Max).
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
51/87
51
tag:
Every activity in the application have to be declared in a separate tag. From
here we can assign which activity should run first and declare the activities names for the
system to know what activity to run when starting an activity in the runtime.
Tag example: the main activity that appears in ByteTransfer App.
action.MAIN means that the main activity to start is this activity (.ByteTransfer).
.LAUNCHER means that the application will launch the application from this activity
(the app’s icon that is displayed on the menu).
6.3 SQLite
In ByteTranfer application the SQLite database is used for logging transactions (file
transfers and instant messaging). The ERD of the database created in ByteTransfer is
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
52/87
52
provided in chapter 5. Database created in the application is only accessible by the
application itself.
The creation of the database along with the Queries made on that database is declared in a
class called [DbHelper] that extends SQLiteOpenHelper class, which is the class thathelps managing the database creation and updating.
Whenever a transaction is made a function [.getWritableDatabase(); ] in class
[HistoryLog] is invoked. This function will open the database for writing, deleting or
retrieving.
6.4 Views
Buttons:
Ping , button to check for available IP addresses. File Transfer , selecting file transferring mode. Instant Messaging , selecting chatting mode. Start Chatting , setting streams up and start chatting with the second peer. Send , button to send the message after typing it. Clear , clears the chatting area.
ListViews:
IPs List, all available IPs are listed here. Files List, when choosing the file transferring mode, the devices files are
listed here. File Transfer Logs List , list that contains recently sent/received files. Instant Messaging Logs Peers List , list peers that the user have recently
chat with.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
53/87
53
UserText
Instant Messaging text filed to write the desired message to be sent.
Send file function code snippet:
// /// send File
byte [] mybytearray = new byte [(int ) fileClickedFile .length()];
fis = new FileInputStream( fileClickedFile ); = new BufferedInputStream( fis);
bis.read(mybytearray, 0, mybytearray. length );
OutputStream os = socket.getOutputStream();
int start = ( int ) System. currentTimeMillis ();
os.write(mybytearray, 0, mybytearray. length );
os.flush();
socket.close();
6.5 Android Package
The implementation phase output is a file with the extension (.apk), which is the
extension of all Android applications. To deploy the application on the Google’s play
market a signed application has to be exported. A signed application contains a private
key and information for the market to be able to recognize the author of the application.
Exporting a signed application is achieved by following these steps through the Eclipse
IDE:
Right click the project. Select ‘Android tools’.
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
54/87
54
Click on ‘Export signed application’.
Then Following the wizard for creating the private key and specify the author’s
information.
6.6 Publishing on the Market
After registration as a developer, to publish the app on the market the developer should
go to the following link: [ http://market.android.com/publish/Home ].
Line of Codes:
Java XML
2479 274
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
55/87
55
Chapter 7 – Testing Documentation
Testing phase is conducted after the implementation phase is done. In this phase software
is being tested to uncover and correct as many errors as possible.
7.1 Testing Approach
White box technique is used to test each component, that is, testing the internal program
logic. And then black box technique is used to test the system’s requirements. Added to
that, tests are made during the actual coding of every component.
7.2 Testing Plan
7.2.1 Unit Testing
Component To Test Expected Result ResultCommunicationScreenActivity Properly selecting
modes
Starting the selected
mode
Pas
DatabaseQueryActivity Retrieving Logs fromDatabase accordingTo type selectedFrom the menu
Retrieve selected log Pass
FilesListActivity List files, and on longPress send file toOther peer
Send request, receiveChoice and actAccordingly (send orcancel)
Pas
HistoryLog Creating theDatabase, and executeAll transactions whenRequested at theApps runtime.
Execute database transactionSuccessfully (insert, delete,select)
Pas
InstantMessagingActivity Chatting between devices Send message whenClicking on the send button andEnsure that the message have
Pas
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
56/87
56
Been reached to the second dev.MainByteTransferActivity Searching for available
IPs over the networkList all IPs that are joining theApp’s port
Pas
ImPeerHistoryList List all peers that the user
Recently chat with
All peers should be retrieved from
database
Pas
7.2.2 Integration Testing
When unit testing was finished, I stepped into the testing of the application’s
requirements stated in chapter 1 (Deliverables, section 1.5.1).
Requirement Achievement
ByteTransfer is operable on any Wi-Fi accesspoint.
Pass. Tested on many access points.
Is capable of transferring any file with any size. Pass, with strict file size to approx. 1.99 GBbecause of the int primitive datatype that the byte[] array takes inits size. (if long primitive type is used, sizecould be widen to up to mostly any size !!! )
Operates on Android OS 2.2 and higher Pass. Tested on Samsung S3 with OS 4.2.1,Tested on Samsung S2 with OS 4.0.1,Tested on Samsung S1 with OS 4.0.1,Tested on LG P500 with OS 2.2.1
Search Files from the files list. Not Passes, because of time.SQLite database to save logs. Passed.Users will be able to fetch logs. Passed, through the menu specified for this.Adapting the interface to the screen size. Passed.
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
57/87
57
Chapter 8 – Summary and Conclusion
8.1 Conclusion
This project conformed to the classic software development lifecycle (the waterfall
model), and every phase of it was discussed through the stated chapters.
During the development of this project I learned a lot about different new technologies
and techniques, especially the Java socket programming that I learned extensively and the
most important the Android development structure and its SDK.
For me it was a challenge stepping into the mobile applications world and starting from
scratch learning the Android environment.
8.2 Future Work
Current Application:
Overall reviewing for the application, also layout and graphical additions. Support sending of multiple files. Support of searching files to send.
Other possible ideas:
To develop an application for educational purposes (chapter 1). Developing an iOS application (same structure), so Android and iOS based
devices could communicate.
________________________________________________________________________
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
58/87
58
Appendix ‘A’ – Activity Diagrams
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
59/87
59
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
60/87
60
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
61/87
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
62/87
62
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
63/87
63
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
64/87
64
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
65/87
65
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
66/87
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
67/87
67
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
68/87
68
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
69/87
69
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
70/87
70
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
71/87
71
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
72/87
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
73/87
73
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
74/87
74
Appendix ‘B’ – Sequence Diagrams
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
75/87
75
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
76/87
76
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
77/87
77
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
78/87
78
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
79/87
79
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
80/87
80
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
81/87
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
82/87
82
break ;}}
public boolean pingAddress(String ip, int port) {
Socket socket = new Socket();try {socket.connect( new InetSocketAddress(ip, port), 200);
ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());out.writeObject( "justping" );out.flush();
ObjectInputStream in = new ObjectInputStream(socket.getInputStream()); pingedDeviceName = (String) in.readObject();socket.close();} catch (IOException e) {return false ;} catch (ClassNotFoundException e) {e.printStackTrace();}
return true ;
}
Request Transfer Connection
public void run() {Socket socket = new Socket();try {socket.connect( new InetSocketAddress( ip , 6789), 200);requestOut = new ObjectOutputStream(socket.getOutputStream());requestOut .writeObject( choice );requestOut .flush();socket.close();serverSocket .close();
Bundle bundle = new Bundle();Intent intent = null ;if ( choice .equals( " -[File Transfer]- " )) {intent = new Intent( commScreen_context ,FilesListActivity. class );} else if ( choice .equals( " -[Instant Messaging]- " )) {intent = new Intent( commScreen_context ,
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
83/87
83
InstantMessagingActivity. class );}
bundle.putString( "share" , receivedSharedData );intent.putExtras(bundle);commScreen_context .startActivity(intent);
} catch (IOException e) {Log. d ( "Error" , "Connection Error!" );e.printStackTrace();}
}
Accept Transfer Connection
ublic void run() {ry {erverSocket = new ServerSocket(6789, 200);onnectionServ = serverSocket .accept();og. d ( "TEXT" , "TEXT" );
equestIn = new ObjectInputStream(onnectionServ .getInputStream());equestString = (String) requestIn .readObject();erverSocket .close();andler .post( new OptionSelectedAlertDialogRunnable());
while (! okToContinue ) {
f ( requestString .equals( " -[File Transfer]- " )) {Bundle bundle = new Bundle();ntent intent = new Intent( commScreen_context ,ilesListActivity. class );undle.putString( "share" , receivedSharedData );ntent.putExtras(bundle);ommScreen_context .startActivity(intent);
else if ( requestString .equals( " -[Instant Messaging]- " )) {Bundle bundle = new Bundle();ntent intent = new Intent( commScreen_context ,nstantMessagingActivity. class );undle.putString( "share" , receivedSharedData );ntent.putExtras(bundle);ommScreen_context .startActivity(intent);
catch (IOException e) {og. d ( "Error" , "Connection Error!" );e.printStackTrace();
catch (ClassNotFoundException e) {TODO Auto-generated catch block
.printStackTrace();
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
84/87
84
Received Files Logging
RECEIVED_FILES_LOG_HISTORY_TABLE createEntry ublic long rfCreateEntry(String file_name, String source,tring file_type, String date_received, String completed,tring size) {
TODO Auto-generated method stub ContentValues cv = new ContentValues();v.put( KEY_RF_FILE_NAME, file_name);v.put( KEY_RF_SOURCE, source);v.put( KEY_RF_FILE_TYPE , file_type);v.put( KEY_RF_DATE_RECEIVED , date_received);v.put( KEY_RF_COMPLETED, completed);v.put( KEY_RF_SIZE , size);eturn ourDatabase .insert( RECEIVED_FILES_LOG_HISTORY_TABLE , null , cv);
Sending File
ublic void run() {ocket socket = new Socket();
ry {ocket.connect( new InetSocketAddress( sharedIp , 6789), 200);equestFileOutClient = new ObjectOutputStream(ocket.getOutputStream());
equestFileOutClient .writeObject( fileClickedName );equestFileOutClient .flush();
equestFileInClient = new ObjectInputStream(ocket.getInputStream());oSendOrNot = (String) requestFileInClient .readObject();
f ( toSendOrNot .equals( "oktosend" )) {
/// send File yte [] mybytearray = new byte [( int ) fileClickedFile ength()];is = new FileInputStream( fileClickedFile );
is = new BufferedInputStream( fis );is .read(mybytearray, 0, mybytearray. length );OutputStream os = socket.getOutputStream();nt start = ( int ) System. currentTimeMillis ();s.write(mybytearray, 0, mybytearray. length );s.flush();bis.close(); // //
ocket.close();nt end = ( int ) System. currentTimeMillis ();eneralAlertDialog = "File received in: " String. valueOf ((end - start) / 1000) + " seconds" ;
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
85/87
85
andler .post( new GeneralAlertDialogRunnable());
save sent file log to database oolean didItWork = true ;ry {
tring file_name, destination, file_type, date_sent, completed, size;ile_name = fileClickedName ;estination = clientDeviceName ;ile_type = getExtension ( fileClickedFile );ate_sent = getDate ();ompleted = "Yes" ;
ize = StringvalueOf ( fileClickedFile .length() / 1024 / 1024)
" MB" ;handling in kbs file size case
f (size.equals( "0 MB" )) {ize = String
valueOf ( fileClickedFile .length() / 1024)" KB" ;
HistoryLog entry = new HistoryLog( fileList_context );ntry.open();ntry.sfCreateEntry(file_name, destination, file_type,ate_sent, completed, size);ntry.close();
catch (Exception e) {idItWork = false ;rror = e.toString();andler .post( new DatabaseDialogNoRunnable());
finally {f (didItWork) {andler .post( new DatabaseDialogYesRunnable());
ReceiveFileSendRequestThread ReceiveFileSendRequestThread = new ReceiveFileSendRequestThread();ReceiveFileSendRequestThread.start();
else if ( toSendOrNot .equals( "notosend" )) {don't send anything
ocket.close();ReceiveFileSendRequestThread ReceiveFileSendRequestThread = new ReceiveFileSendRequestThread();ReceiveFileSendRequestThread.start();
andler .post( new ClientFileSendAlertDialogRunnable());
catch (IOException e) {og. d ( "Connection Error:" ,Other device terminated the serverSocket" );
catch (ClassNotFoundException e) {TODO Auto-generated catch block
.printStackTrace(); }}
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
86/87
86
8/15/2019 ByteTransfer Android App Doc. (April 6, 2013)
87/87
Bibliography
1. Java Network Programming and Distributed Computing. [David Reilly &Michael Reilly]
2. Software Engineering, A Practitioner ’s Approach. [Roger S. Pressman, Ph.D.]3. Tutorials by Bucky Roberts, establisher of The New Boston website and
forums [www.thenewboston.com], last accessed January 27, 2013.4. TCP protocol [http://en.kioskea.net/contents/internet/TCP.php3], last accessed
January 27, 2013.5. Android Operating System
[http://en.wikipedia.org/wiki/Android_(operating_system)] &[http://developer.android.com/about/index.html], last accessed January 27,2013.
6. Installing Android Environment[http://developer.android.com/sdk/installing/bundle.html], last accessedJanuary 27, 2013.
7. Market Share, Q3 2012 Image [http://macdailynews.com/2012/11/02/idc-googles-android-hits-75-smartphone-market-share-worldwide/], last accessedJanuary 27, 2013.
8. Android Architecture Image[http://developer.android.com/about/versions/index.html], last accessedJanuary 27, 2013.
9. TCP/IP Model Image [http://www.iekucukcay.com/?p=12], last accessed
January 27, 2013.10. Android Activity Lifecycle Image
[http://developer.android.com/training/basics/activity-lifecycle/starting.html],last accessed January 27, 2013.
____________________________________________________________________________