SlideShare une entreprise Scribd logo
1  sur  65
Télécharger pour lire hors ligne
1
Chapter 1
Introduction
2
1.1 What is Android ?
Android is basically an operating system for smartphones. But we find now integrated into
PDAs, Touch pads or televisions, even cars (trip computer) or netbooks. The OS was
created by the start-up of the same name, which is owned by Google since 2005.
1.1.1 Specifications
This operating system is based on version 2.6 of Linux, so it has a monolithic system
kernel, what means that all system functions and drivers are grouped into one block of
code.
1.1.2 Architecture
Android consists of five layers:
-The Linux kernel 2.6-which includes useful drivers that allow for example Wi-Fi or
Bluetooth.
-The library written in C and C + + that provide higher level functionality such as an
HTML engine, or a database (SQLite).
-A runtime environment for applications based on a virtual machine, made for inefficient
machines such as telephones. The aim is to translate JAVA in machine language
understood by Android.
-A JAVA framework that allows applications running on the virtual machine to organize
and cooperate.
-The user applications written in Java (Web browser, contact manager etc.).
1.2 Understanding the Android Software Stack
The Android software stack is composed of the elements shown in Figure 1-1 and
described in further detail below it. Put simply, a Linux kernel and a collection of C/C++
libraries are exposed through an application framework that provides services for, and
management of, the run time and applications.
3
Figure 1.1- Android Software Stack
1.2.1 Linux Kernel
Core services (including hardware drivers, process and memory management, security,
network, and power management) are handled by a Linux 2.6 kernel. The kernel also
provides an abstraction layer between the hardware and the remainder of the stack.
1.2.2 Libraries
Running on top of the kernel, Android includes various C/C++ core libraries such as libc
and SSL, as well as:
A media library for playback of audio and video media A
Surface manager to provide display management
Graphics libraries that include SGL and OpenGL for 2D and 3D graphics SQLite for
native database support
SSL and WebKit for integrated web browser and Internet security
1.2.3 Android Run Time
What makes an Android phone an Android phone rather than a mobile Linux
implementation is the Android run time. Including the core libraries and the Dalvik virtual
machine, the Android run time is the engine that powers your applications and, along with
the libraries, forms the basis for the application framework.
4
1.2.4 Core Libraries
While Android development is done in Java, Dalvik is not a Java VM. The core Android
libraries provide most of the functionality available in the core Java libraries as well as the
Android-specific libraries.
1.2.5 Dalvik Virtual Machine
Dalvik is a register-based virtual machine that‘s been optimized to ensure that a device can
run multiple instances efficiently. It relies on the Linux kernel for threading and low-level
memory management.
1.2.6 Application Framework
The application framework provides the classes used to create Android applications. It also
provides a generic abstraction for hardware access and manages the user interface and
application resources.
1.2.7 Application Layer
All applications, both native and third party, are built on the application layer using
the same API libraries. The application layer runs within the Android run time using
the classes and services made available from the application framework
1.3 The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik virtual machine. Rather than use a
traditional Java virtual machine (VM) such as Java ME (Java Mobile Edition), Android
uses its own custom VM designed to ensure that multiple instances run efficiently on a
single device.
The Dalvik VM uses the device‘s underlying Linux kernel to handle low-level
functionality including security, threading, and process and memory management. It‘s also
possible to write C/C++ applications that run directly on the underlying Linux OS. While
you can do this, in most cases there‘s no reason you should need to.
All Android hardware and system service access is managed using Dalvik as a middle tier.
By using a VM to host application execution, developers have an abstraction layer that
ensures they never have to worry about a particular hardware implementation.
The Dalvik VM executes Dalvik executable files, a format optimized to ensure minimal
memory footprint.
The .dex executable is created by transforming Java language compiled classes using the
tools supplied within the SDK.
5
1.4 Android Application Architecture
Android‘s architecture encourages the concept of component reuse, allowing you to
publish and share activities, services, and data with other applications with access
managed by the security restrictions you put in place.
The same mechanism that lets you produce a replacement contact manager or phone
dialer can let you expose your application components to let other developers create
new UI front ends and functionality extensions, or otherwise build on them.
The following application services are the architectural cornerstones of all Android
applications, providing the framework you‘ll be using for your own software:
 Activity Manager Controls the life cycle of your activities, including
management of the activity Stack. 
 Views Are used to construct the user interfaces for your activities. 
 Notification Manager Provides a consistent and non-intrusive mechanism for
signalling your Users.
 Content Providers Lets your applications share data between applications. 
 Resource Manager Supports non-code resources like strings and graphics to be
externalized.
1.5 Android Libraries
Android offers a number of APIs for developing your applications. The following list of
core APIs should provide an insight into what‘s available; all Android devices will offer
support for at least these APIs:
 android.util The core utility package contains low-level classes like specialized
containers, string formatters, and XML parsing utilities. 

 android.os The operating system package provides access to basic 
operating System services like message passing, interprocess
communication, clock functions
 android.graphics The graphics API supplies the low-level graphics classes that
support canvases,colors, and drawing primitives, and lets you draw on canvases. 

 android.text The text processing tools for displaying and parsing text. 


 android.database Supplies the low-level classes required for handling cursors
when working with databases. 
6
 android.content The content API is used to manage data access and publishing by
providing services for dealing with resources, content providers, and packages. 



 android.view Views are the core user interface class. All user interface elements are
constructed using a series of Views to provide the user interaction components. 


 android.widget Built on the View package, the widget classes are the ―here‘s one
we created earlier‖ user-interface elements for you to use in your applications. They
include lists, buttons, and layouts. 


 com.google.android.maps A high-level API that provides access to native map
controls that you can use within your application. Includes the MapView control as
well as the Overlay and MapController classes used to annotate and control your
embedded maps. 

 android.app A high-level package that provides access to the application model. The
application package includes the Activity and Service APIs that form the basis for all
your Android applications. 


 android.provider To ease developer access to certain standard Content Providers
(such as the contacts database), the Provider package offers classes to 
provide access to standard databases included in all Android distributions.
 android.telephony The telephony APIs give you the ability to directly interact with the
device‘s phone stack, letting you make, receive, and monitor phone calls, phone status,
and SMS messages.
 android.webkit The WebKit package features APIs for working with Web- based 
content, including a WebView control for embedding browsers in your activities and a cookie
manager.
 In addition to the Android APIs, the Android stack includes a set of C/C++ libraries
that are exposed through the application framework. These libraries include: 



1.6 Advanced Android Libraries
The core libraries provide all the functionality you need to start creating applications for
Android, but it won‘t be long before you‘re ready to delve into the advanced APIs that
offer the really exciting functionality.
Android hopes to target a wide range of mobile hardware, so be aware that the suitability
and implementation of the following APIs will vary depending on the device upon which
they are implemented.

7


 android.location The location-based services API gives your applications 
access to the devices current physical location.
Location-based services provide generic access to location information using
whatever position-fixing hardware or technology is available on the device.
 android.media The media APIs provide support for playback and recording of
audio and video media fi les, including streamed media. 


 android.opengl Android offers a powerful 3D rendering engine using the
OpenGL ES API that you can use to create dynamic 3D user interfaces for your
applications. 


 android.hardware Where available, the hardware API exposes sensor hardware
including the camera, accelerometer, and compass sensors 

 android.bluetooth android.net.wifi , and android.telephony Android also 
provides low-level access to the hardware platform, including Bluetooth, Wi-Fi,
and telephony hardware
1.7 Android and Java
In Java, you write your Java source file, compile it into a Java byte code using the Java
compiler, and then run this byte code on the Java VM. In Android, things are different.
You still write the Java source file, and you still compile it to Java byte code using the
same Java compiler. But at that point, you recompile it once again using the Dalvik
compiler to Dalvik byte code. It is this Dalvik byte code that is then executed on the
Dalvik VM. Figure illustrates this comparison between standard Java (on the left) in
Android using Dalvik (on the right).
Figure 1.2 Java Versus Dalvik
8
You may wonder, why not compile straight from Java into the Dalvik byte code?
There are a couple of good reasons for the extra steps. Back in 2005, when work on
Dalvik started, the Java language was going through frequent changes, but the Java byte
code was more or less set in stone. So, the Android team chose to base Dalvik on Java
byte code instead of Java source code.
A side effect of this is that in theory you could write Android applications in any other
language that compiles down to Java byte code. For example, you could use Python or
Ruby. I say ―in theory‖ because in practice the appropriate libraries that are part of the
SDK would need to be available. But it is likely that the open source community will come
up with a solution to that in the future.
Another thing to keep in mind is that Android Java is a nonstandard collection of Java
classes. Java typically ships in:
-Java Standard Edition
Used for development on basic desktop-type applications
-Java Enterprise Edition (aka J2EE or JavaEE) Used for
development of enterprise applications
-Java Micro Edition (aka J2ME or JavaME)
-Java for mobile applications
Android‘s Java set of libraries is closest to Java Standard Edition.
The major difference is that Java user interface libraries (AWT and Swing) have been
taken out and replaced with Android-specific user interface libraries. Android also adds
quite a few new features to standard Java while supporting most of Java‘s standard
features. So, you have most of your favourite Java libraries at your disposal, plus
manynew ones.
1.8 Application Framework
The application framework is a rich environment that provides numerous services to help
you, the app developer, get your job done. This is the best-documented and most
extensively covered part of the platform because it is this layer that empowers developers
to get creative and bring fantastic applications to the market.
In the application framework layer, you will find numerous Java libraries specifically built
for Android. You will also find many services (or managers) that provide the eco-system
of capabilities your application can tap into, such as location, sensors, WiFi,telephony, and
so on.
9
1.9 Android Version
Android 5.0 - Lollipop
Fig 1.3 -Lollipop
Android 5.0 "Lollipop" was unveiled under the codename "Android L" on June 25, 2014,
during Google I/O. It became available as official over-the-air (OTA) updates on November
12, 2014, for select devices that run distributions of Android serviced by Google, including
Nexus and Google Play edition devices. Its source code was made available on November 3,
2014.Lollipop features a redesigned user interface built around a responsive design language
referred to as "material design". Other changes include improvements to the notifications,
which can be accessed from the lockscreen and displayed within applications as top-of-the-
screen banners. Furthermore, Google made internal changes to the platform, with the Android
Runtime (ART) officially replacing Dalvik for improved application performance, and with
changes intended to improve and optimize battery usage, known internally as Project Volta
Android 4.4 - KitKat
Figure 1.4 – KitKat
Google announced Android 4.4 KitKat on September 3, 2013. Although initially under the
"Key Lime Pie" ("KLP") codename, the name was changed because "very few people
actually know the taste of a key lime pie."[129] Some technology bloggers also expected the
"Key Lime Pie" release to be Android 5.[130] KitKat debuted on Google's Nexus 5 on
October 31, 2013, and was optimised to run on a greater range of devices than earlier
Android versions, having 512 MB of RAM as a recommended minimum; those
improvements were known as "Project Svelte" internally at Google.[131] The required
minimum amount of RAM available to Android is 340 MB, and all devices with less than
512 MB of RAM must report themselves as "low RAM" devices.
10
Android 4.1-4.3 - Jelly Bean
Figure 1.5 – Jelly Bean
Jelly Bean arrived at Google IO 2012, with the release of the ASUS Nexus 7, followed by a
quick update for unlocked Galaxy Nexus phones. Later in the year, the release of the Nexus
10 and Nexus 4 updated things from 4.1 to 4.2 and on to 4.3, but the version remained Jelly
Bean. The release polished the UI design started in Ice Cream Sandwich, and brought
several great new features to the table.
Besides the new focus on responsiveness with Project Butter, Jelly Bean brings multi-user
accounts, actionable notifications, lock screen widgets, quick-settings in the notification bar,
Photosphere to the "stock" Android camera and Google Now.
Jelly Bean is hailed by many as the turning point for Android, where all the great services
and customization options finally meet great design guidelines. It's certainly very visually
pleasing, and we'd argue that it's become one of the nicest looking mobile operating systems
available.
Android 4.0 - Ice Cream Sandwich
Figure 1.6 – Ice Cream Sandwich
The follow-up to Honeycomb was announced at Google IO in May 2011 and released in
December 2011. Dubbed Ice Cream Sandwich and finally designated Android 4.0, Ice
11
Cream Sandwich brings many of the design elements of Honeycomb to smartphones, while
refining the Honeycomb experience.
The first device to launch with ICS was the Samsung Galaxy Nexus.
1.10Wifi-Direct
1.10.1 Introduction
• Wi-Fi direct is new technology defined by the Wi-Fi alliance aimed at enhancing
direct device to device communication without requiring a wireless access point.
• Wi-Fi direct builds upon the successful IEEE 802.11 infrastructure mode and lets
devices negotiate who will take over the AP-like functionalities.
• Direct device to device connectivity was already possible in original IEEE 802.11
standard but it contains many drawbacks such as lack of power saving or extended
QoS capabilities.
• Wi-Fi device to device communication space is 802.11z, also known as Tunneled
Direct Link Setup (TDLS), which enables direct device to device communication but
requires station to associate with the same AP.
1.10.2 Technical Overview
• In a typical Wi-Fi network, client scans and associate to wireless networks available,
which are created and announced by Access Points (AP).
• Wi-Fi Direct is that these roles are specified as dynamic, and hence a Wi-Fi Direct
device has to implement both the role of a client and the role of an AP.
• These roles are therefore logical roles that could even be executed simultaneously by
the same device, this type of operation is called Concurrent mode.
•
1.10.3 Architecture
• Wi-Fi direct device communicate by establishing P2P group.
• The device implementing AP-like functionality in P2P group is referred to as the P2P
Group Owner (P2P GO), and device acting as client are known as P2P clients.
• Once P2P group is established, other P2P clients can join the group as in a traditional
Wi-Fi network.
• When the device act as both as P2P client and as P2P GO the device will typically
alternate between the two roles by time-sharing the Wi-Fi interface.(Example: Laptop
2 in upper fig.)
• Like a traditional AP, a P2P GO announces itself through beacons, and has to support
power saving for its associated clients.
• Only the P2P GO is allowed to cross-connect the devices in its P2P group to an
external network (Example: Mobile in upper fig.)
12
• This connection must be done at network layer, typically implemented using Network
Address Translation (NAT).
• Wi-Fi direct does not allow transferring the role of P2P GO within the group.
Figure 1.7 – Wifi Direct Architecture
1.10.4 Group Formation
• Three types of group formation techniques are Standard, Autonomous and Persistent
cases.
• Group Formation procedure involves two phases-
 Determination of P2P Group owner
 Negotiated - Two P2P devices negotiate for P2P group owner based
on desire/capabilities to be a P2P GO
 Selected - P2P group Owner role established at formation or at an
application level
 Provisioning of P2P Group
 Establishment of P2P group session using appropriate credentials
 Using Wi-Fi simple configuration to exchange credentials.
• Standard: In this case the P2P device have to discover each other, and then negotiate
which device will act as P2P GO.
• Its start by performing a traditional Wi-Fi scan, by means of which they can discover
existent groups and Wi-Fi network.
13
• To prevent conflicts when two devices declare the same GO Intent, a tie-breaker bit is
included in the GO Negotiation Request, which is randomly set every time a GO
Negotiation Request is sent.
Figure 1.8 – Group Formation in Wifi Direct
• Autonomous: A P2P device may autonomously create a P2P group, where it
immediately becomes the P2P GO, by sitting on a channel and starting a beacon.
• Other devices can discover the established group using traditional scanning
mechanisms.
• As compared to previous case, the discovery phase is simplified in this case as the
device establishing the group does not alternate between states, and indeed no GO
negotiation phase is required.
• Persistent: In this process, P2P device can declare a group as persistent, by using
flag in the P2P capabilities attribute present in beacon frames.
• After the discovery phase, if a P2P device recognizes to have formed a persistent
group with the corresponding peer in the past, any of the two P2P devices can use the
Invitation Procedure to quickly re-instantiate the group.
1.10.5 Security
• Wi-Fi Direct devices are required to implement Wi-Fi Protected Setup (WPS) to
support a secure connection with minimal user intervention.
• WPS allows establishing a secure connection by introducing a PIN in the P2P Client,
or pushing a button in the two P2P Devices.
• Following WPS terminology, the P2P GO is required to implement an internal
Registrar, and the P2P Client is required to implement an Enrollee.
• The operation of WPS is composed of two parts. In the first part, the internal
Registrar is in charge of generating and issuing the network credentials, i.e., security
keys, to the Enrollee.
14
• In the second part, the Enrollee (P2P Client) disassociates and reconnects using its
new authentication credentials.
1.10.6 Power Saving
• Wi-Fi Direct defines two new power saving mechanisms: the Opportunistic Power
Save protocol and the Notice of Absence (NOA) protocol.
• Opportunistic Power Save protocol (OPS) allows a P2P GO to save power when all
its associated clients are sleeping.
• The P2P Group Owner can only save power when all its clients are sleeping.
Figure 1.9 – Power Saving in Wifi Direct
• Notice of absence protocol (NOA) allows a P2P GO to announce time intervals,
referred to as absence periods, where P2P Clients are not allowed to access the
channel.
• P2P GO defines a NOA schedule using four parameters:
 Duration that specifies the length of each absence period
 Interval that specifies the time between consecutive absence periods
 Time that specifies the start time of the first absence period after the
current Beacon frame
 Count that specifies how many absence periods will be scheduled
during the current NOA schedule.
15
Fig 1.10- NOA protocol in Wifi Direct
1.10.7 Benefits
 Some of the benefits consumers will see from Wi-Fi Direct devices.
 Mobility & Portability: Wi-Fi Direct-certified devices connect anytime, anywhere.
 Immediate Utility: Users have the ability to create direct connections with the very
first Wi-Fi Direct-certified device they bring home. For example, a new laptop
certified for Wi-Fi Direct can create direct connections with the existing legacy Wi-Fi
devices in the user’s home.
 Ease of Use: Wi-Fi Direct devices have features that allow users to identify available
devices and services before establishing a connection.
 Simple Secure Connections: Wi-Fi Protected Setup makes it simple to create security-
protected connections between devices. Users in most cases will be able to connect at
the push of a button.
1.10.8 Conclusions
• Wi-Fi alliance has recently developed the Wi-Fi Direct technology that builds upon
the Wi-Fi infrastructure mode to enable direct device to device connectivity.
• In this article we presented a thorough overview of the novel technical features
specified in Wi-Fi Direct, following by the group formation, and other performance
analysis such as power saving and security in this device.
• The NOA protocol could also be re-used to virtualize the roles of P2P GO/Client over
multiple concurrent P2P Groups.
• Concurrent operation together with dynamic nature of the P2P GO/Client roles could
be used to improve performance in dense environments, for instance by means of
dynamic relays.
16
17
Chapter 2
Android SDK
18
The true appeal of Android as a development environment lays in the APIs it provides.
As an application-neutral platform, Android gives you the opportunity to create applications
that are as much a part of the phone as anything provided out of the box. The following list
highlights some of the most noteworthy Android features:
 No licensing, distribution, or development fees or release approval processes.
 Wi-Fi hardware access. 


 GSM, EDGE, and 3G networks for telephony or data transfer, enabling you to
make or receive calls or SMS messages, or to send and retrieve data across mobile
networks. 

 Comprehensive APIs for location-based services such as GPS. 


 Full Multimedia hardware control, including playback and recording with the
camera and microphone. 

 APIs for using sensor hardware, including accelerometers and the compass. 

 Libraries for using Bluetooth for peer-to-peer data transfer. 

 IPC message passing. 

 Shared data stores. 

 Background applications and processes. 

 Home-screen Widgets, Live Folders, and Live Wallpaper. 

 The ability to integrate application search results into the system search. 

 An integrated open-source HTML5 Web Kit-based browser. 


 Full support for applications that integrate map controls as part of their user
interface. 


 Mobile-optimized hardware-accelerated graphics, including a path-based
2Dgraphics library and support for 3D graphics using OpenGL ES 2.0 
19
20
Chapter 3
Activity Life Cycle
21
As a user navigates through, out of, and back to your app, the Activity instances in your app
transition between different states in their lifecycle. For instance, when your activity starts
for the first time, it comes to the foreground of the system and receives user focus. During
this process, the Android system calls a series of lifecycle methods on the activity in which
you set up the user interface and other components. If the user performs an action that starts
another activity or switches to another app, the system calls another set of lifecycle methods
on your activity as it moves into the background (where the activity is no longer visible, but
the instance and its state remains intact).
Within the lifecycle callback methods, you can declare how your activity behaves when the
user leaves and re-enters the activity. For example, if you're building a streaming video
player, you might pause the video and terminate the network connection when the user
switches to another app. When the user returns, you can reconnect to the network and allow
the user to resume the video from the same spot.
This class explains important lifecycle callback methods that each Activity instance
receives and how you can use them so your activity does what the user expects and does
not consume system resources when your activity doesn't need them.
3.1 Starting an Activity:
Unlike other programming paradigms in which apps are launched with a main() method, the
Android system initiates code in an Activity instance by invoking specific callback methods
that correspond to specific stages of its lifecycle. There is a sequence of callback methods
that start up an activity and a sequence of callback methods that tear down an activity.
This lesson provides an overview of the most important lifecycle methods and shows you
how to handle the first lifecycle callback that creates a new instance of your activity.
3.2 Understand the Lifecycle
During the life of an activity, the system calls a core set of lifecycle methods in a sequence
similar to a step pyramid. That is, each stage of the activity lifecycle is a separate step on
the pyramid. As the system creates a new activity instance, each callback method moves
the activity state one step toward the top. The top of the pyramid is the point at which the
activity is running in the foreground and the user can interact with it.
As the user begins to leave the activity, the system calls other methods that move the
activity state back down the pyramid in order to dismantle the activity. In some cases, the
activity will move only part way down the pyramid and wait (such as when the user
switches to another app), from which point the activity can move back to the top (if the user
returns to the activity) and resume where the user left off.
Depending on the complexity of your activity, you probably don't need to implement all the
lifecycle methods. However, it's important that you understand each one and implement
those that ensure your app behaves the way users expect. Implementing your activity
lifecycle methods properly ensures your app behaves well in several ways, including that it:
22
Does not crash if the user receives a phone call or switches to another app while using your
app.
Does not consume valuable system resources when the user is not actively using it.
Figure 3.1-Android Lifecycle
3.3 Pausing and Resuming an Activity:
During normal app use, the foreground activity is sometimes obstructed by other visual
components that cause the activity to pause. For example, when a semi- transparent activity
opens (such as one in the style of a dialog), the previous activity pauses. As long as the
activity is still partially visible but currently not the activity in focus, it remains paused.
However, once the activity is fully-obstructed and not visible, it stops (which is discussed in
the next lesson).
As your activity enters the paused state, the system calls the onPause() method on your
Activity, which allows you to stop ongoing actions that should not continue while paused
(such as a video) or persist any information that should be permanently saved in case the
user continues to leave your app. If the user returns to your activity from the paused state,
the system resumes it and calls the on Resume() method
3.4 Stopping and Restarting an Activity:
Properly stopping and restarting your activity is an important process in the activity lifecycle
that ensures your users perceive that your app is always alive and doesn't lose their progress.
There are a few of key scenarios in which your activity is stopped and restarted:
The user opens the Recent Apps window and switches from your app to another app. The
activity in your app that's currently in the foreground is stopped. If the user returnsto your
app from the Home screen launcher icon or the Recent Apps window, the activity restarts.
The user performs an action in your app that starts a new activity. The current activity
23
is stopped when the second activity is created. If the user then presses the Back button, the
first activity is restarted.
The user receives a phone call while using your app on his or her phone.
The Activity class provides two lifecycle methods, onStop() and onRestart(), which allow
you to specifically handle how your activity handles being stopped and restarted. Unlike the
paused state, which identifies a partial UI obstruction, the stopped state guarantees that the
UI is no longer visible and the user's focus is in a separate activity (or an entirely separate
app).
3.5 Recreating an Activity:
There are a few scenarios in which your activity is destroyed due to normal app behavior,
such as when the user presses the Back button or your activity signals its own destruction by
calling finish(). The system may also destroy your activity if it's currently stopped and hasn't
been used in a long time or the foreground activity requires more resources so the system
must shut down background processes to recover memory.
When your activity is destroyed because the user presses Back or the activity finishes itself,
the system's concept of that Activity instance is gone forever because the behavior indicates
the activity is no longer needed. However, if the system destroys the activity due to system
constraints (rather than normal app behavior), then although the actual Activity instance is
gone, the system remembers that it existed such that if the user navigates back to it, the
system creates a new instance of the activity using a set of saved data that describes the state
of the activity when it was destroyed. The saved data that the system uses to restore the
previous state is called the "instance state" and is a collection of key- value pairs stored in a
Bundle object.
Caution: Your activity will be destroyed and recreated each time the user rotates the screen.
When the screen changes orientation, the system destroys and recreates the foreground
activity because the screen configuration has changed and your activity might need to load
alternative resources (such as the layout).
By default, the system uses the Bundle instance state to save information about each View
object in your activity layout (such as the text value entered into an EditText object..
Figure 3.2- Recreating an activity
24
25
Chapter 4
Networking in Android
26
4.1 Overview of HTTP access on Android
4.1.1 Available official API's
Android contains the standard Java network java.net package which can be used to access
network resources. The base class for HTTP network access in the java.net package is
the HttpUrlConnection class.
4.1.2 Required permissions
To access the Internet your application requires the android.permission.INTERNET
permission. To check the network state your application requires the
android.permission.ACCESS_NETWORK_STATE permission.
4.1.3. Good practices for network access under Android
Within an Android application you should avoid performing long running operations on
the user interface thread. This includes file and network access.
As of Android 3.0 (Honeycomb) the system is configured to crash with a
NetworkOnMainThreadException exception, if network is accessed in the user interface
thread.
A typical setup for performing network access in a productive Android application is
using a service. While it is possible to do network access from an activity or a fragment,
using a service typical leads to a better overall design because you code in the activity
becomes simpler.
4.2 Java and HTTP access
Java provides a general-purpose, lightweight HTTP client API to access resources via the
HTTP or HTTPS protocol. The main classes to access the Internet are the java.net.URL class
and the java.net.HttpURLConnection class. The URL class can be used to define a pointer to
a web resource while the HttpURLConnection class can be used to access a web resource.
HttpURLConnection allows you to create an InputStream. Once you have accessed an
InputStream you can read it similarly to an InputStream from a local file. In the latest version
HttpURLConnection supports the transparent response compression (via the headerAccept-
Encoding: gzip, Server Name Indication (extension of SSL and TLS) and a response cache.
4.3 Web Sockets
Web Sockets are a standard based on HTTP for asynchronous message-based communication
between a client and a server. To start a web socket communication, you create a HTTP GET
request with a special HTTP headers. If the server accepts this request, the client and the
server can send each other messages. Messages can be text or binary data and should be
relatively small, as the web socket protocol is intended to be used with small payloads in the
data. It is good practice to use JSON as data format for the messages.
27
4.4 AsyncTask
4.4.1Class-Overview
AsyncTask enables proper and easy use of the UI thread. This class allows to perform
background operations and publish results on the UI thread without having to manipulate
threads and/or handlers. AsyncTask is designed to be a helper class around Thread and
Handler and does not constitute a generic threading framework. AsyncTasks should ideally
be used for short operations (a few seconds at the most.)
An asynchronous task is defined by a computation that runs on a background thread and
whose result is published on the UI thread. An asynchronous task is defined by 3 generic
types, called Params, Progress and Result, and 4 steps, called onPreExecute,
doInBackground, onProgressUpdate and onPostExecute.
4.4.2Usage
AsyncTask must be subclassed to be used. The subclass will override at least one method
(doInBackground(Params...)), and most often will override a second one
(onPostExecute(Result).)
4.4.3 The 4 steps
When an asynchronous task is executed, the task goes through 4 steps:
 onPreExecute(), invoked on the UI thread before the task is executed. This step is
normally used to setup the task, for instance by showing a progress bar in the user
interface.
 doInBackground(Params...), invoked on the background thread immediately after
onPreExecute() finishes executing. This step is used to perform background
computation that can take a long time. The parameters of the asynchronous task are
passed to this step. The result of the computation must be returned by this step and
will be passed back to the last step. This step can also use publishProgress(Progress...)
to publish one or more units of progress. These values are published on the UI thread,
in the onProgressUpdate(Progress...) step.
 onProgressUpdate(Progress...), invoked on the UI thread after a call to
publishProgress(Progress...). The timing of the execution is undefined. This method is
used to display any form of progress in the user interface while the background
computation is still executing. For instance, it can be used to animate a progress bar or
show logs in a text field.
 onPostExecute(Result), invoked on the UI thread after the background computation
finishes. The result of the background computation is passed to this step as a
parameter.
4.4.4 Cancelling a task
A task can be cancelled at any time by invoking cancel(boolean). Invoking this method will
cause subsequent calls to isCancelled() to return true. After invoking this method,
onCancelled(Object), instead of onPostExecute(Object) will be invoked after
doInBackground(Object[]) returns. To ensure that a task is cancelled as quickly as possible,
28
you should always check the return value of isCancelled() periodically from
doInBackground(Object[]), if possible (inside a loop for instance.)
4.4.5 Threading rules
There are a few threading rules that must be followed for this class to work properly:
 The AsyncTask class must be loaded on the UI thread. This is done automatically as
of Jelly Bean.
 The task instance must be created on the UI thread.
 execute(Params...) must be invoked on the UI thread.
 Do not call onPreExecute(), onPostExecute(Result), doInBackground(Params...),
onProgressUpdate(Progress...) manually.
 The task can be executed only once (an exception will be thrown if a second
execution is attempted.)
4.4.6 Memory observability
AsyncTask guarantees that all callback calls are synchronized in such a way that the
following operations are safe without explicit synchronizations.
 Set member fields in the constructor or onPreExecute(), and refer to them in
doInBackground(Params...).
 Set member fields in doInBackground(Params...), and refer to them in
onProgressUpdate(Progress...) and onPostExecute(Result).
4.4.7 Order of execution
When first introduced, AsyncTasks were executed serially on a single background thread.
Starting with DONUT, this was changed to a pool of threads allowing multiple tasks to
operate in parallel. Starting with HONEYCOMB, tasks are executed on a single thread to
avoid common application errors caused by parallel execution. If you truly want parallel
execution, you can invoke executeOnExecutor(java.util.concurrent.Executor, Object[]) with
THREAD_POOL_EXECUTOR.
29
30
Chapter 5
Other technologies used
31
5.1 Environment
5.1.1 Eclipse IDE
Eclipse is an integrated development environment (IDE). It contains a base workspace and
an extensible plug-in system for customizing the environment. Written mostly in Java,
Eclipse can be used to develop applications. By means of various plug-ins, Eclipse may also
be used to develop applications in other programming languages PHP, Python, R, Ruby
(including Ruby on Rails framework), Scala, Clojure, Groovy, Scheme, and Erlang. It can
also be used to develop packages for the software Mathematica. Development environments
include the Eclipse Java development tools (JDT) for Java and Scala, Eclipse CDT for C/C++
and Eclipse PDT for PHP, among others.
The initial codebase originated from IBM VisualAge.
[2]
The Eclipse software
development kit (SDK), which includes the Java development tools, is meant for Java
developers. Users can extend its abilities by installing plug-ins written for the Eclipse
Platform, such as development toolkits for other programming languages, and can write and
contribute their own plug-in modules.
Version Name Date
Platform
Projects
version
Callisto 30 June 2006 3.2 Callisto projects
Europa 29 June 2007 3.3 Europa projects
Ganymede 25 June 2008 3.4
Ganymede
projects
Galileo 24 June 2009 3.5 Galileo projects
Helios 23 June 2010 3.6 Helios projects
Indigo 22 June 2011 3.7 Indigo projects
Juno 27 June 2012 3.8 and 4.2 Juno projects
Kepler 26 June 2013 4.3 Kepler projects
Luna
25 June 2014
4.4 Luna projects
(planned)
Mars
24 June 2015
4.5 Mars projects
(planned)
Table 5.1- Eclipse Versions
With the exception of a small run-time kernel, everything in Eclipse is a plug-in. This means
that every plug-in developed integrates with Eclipse in exactly the same way as other plug-
ins; in this respect, all features are "created equal". Eclipse provides plug-ins for a wide
variety of features, some of which are through third parties using both free and commercial
models. Examples of plug-ins include for UML, for Sequence and other UML diagrams, a
plug-in for DB Explorer, and many others.
32
5.2 Languages
5.2.1 Java
Java is a computer programming language that is concurrent, class-based, object-oriented,
and specifically designed to have as few implementation dependencies as possible. It is intended
to let application developers "write once, run anywhere" (WORA), meaning that code that
runs on one platform does not need to be recompiled to run on another.
 Java applications are typically compiled to bytecode (class file) that can run on any
Java virtual machine(JVM) regardless of computer architecture.
 Java is, as of 2014, one of the most popular programming languages in use,
particularly for client-server web applications, with a reported 9 million developers. 

 Java was originally developed by James Gosling at Sun Microsystems (which has
since merged into Oracle Corporation) and released in 1995 as a core component of
Sun Microsystems' Java platform. 

 The language derives much of its syntax from C and C++, but it has fewer low-
level facilities than either of them. 
Major release versions of Java, along with their release dates:
 JDK 1.0 (January 21, 1996) 

 JDK 1.1 (February 19, 1997) 

 J2SE 1.2 (December 8, 1998) 

 J2SE 1.3 (May 8, 2000) 

 J2SE 1.4 (February 6, 2002) 

 J2SE 5.0 (September 30, 2004) 

 Java SE 6 (December 11, 2006) 

 Java SE 7 (July 28, 2011) 

 Java SE 8 (March 18, 2014) 

5.2.2 Xml
The design goals of XML emphasize simplicity, generality, and usability over the Internet.
[6]
It is a textual data format with strong support via Unicode for the languages of the world.
Although the design of XML focuses on documents, it is widely used for the representation of
arbitrary data structures,
[7]
for example in web services.
Many application programming interfaces (APIs) developers with processing XML data, and
several based languages have been developed to aid software exist to aid in the definition of
XML-


33
Key terminology
The material in this section is based on the XML Specification. This is not an exhaustive list
of all the constructs that appear in XML; it provides an introduction to the key constructs
most often encountered in day-to-day use.
 (Unicode) character
By definition, an XML document is a string of characters. Almost every
legal Unicode character may appear in an XML document.
 Processor and application 
The processor analyzes the markup and passes structured information to an application. The
specification places requirements on what an XML processor must do and not do, but the
application is outside its scope. The processor (as the specification calls it) is often referred to
colloquially as an XML parser.
 Markup and content 
The characters making up an XML document are divided into markup and content, which
may be distinguished by the application of simple syntactic rules. Generally, strings that
constitute markup either begin with the character < and end with a >, or they begin with the
character & and end with a ;. Strings of characters that are not markup are content. However,
in a CDATAsection, the delimiters <![CDATA[ and ]]> are classified as markup, while the
text between them is classified as content. In addition, whitespace before and after the
outermost element is classified as markup.

 Tag 
A markup construct that begins with < and ends with >. Tags come in three flavors:
 start-tags; for example: <section> 
 end-tags; for example: </section> 
 empty-element tags; for example: <line-break /> 


 Element
A logical document component which either begins with a start-tag and ends with a matching
end-tag or consists only of an empty-element tag. The characters between the start- and end-
tags, if any, are the element's content, and may contain markup, including other elements,
which are called child elements. An example of an element is <Greeting>Hello,
world.</Greeting>(see hello world). Another is <line-break />.
34
35
Chapter 6
Implementation
36
Two types of classes are being used in the application:
 Built-in Packages- Packages which are available to developers by the sdk and the
environment. 

 User created classes- Classes which are created by developers for certain special
requirements in the working of application. 


6.1 Built in packages
6.1.1 android.content
Contains classes for accessing and publishing data on a device. It includes three main categories of
APIs:
 Content sharing (android.content)
For sharing content between application components.
 Package management (android.content.pm)
For accessing information about an Android package (an .apk), including information about its
activities, permissions, services, signatures, and providers. The most important class for accessing this
information is PackageManager.
 Resource management (android.content.res)
For retrieving resource data associated with an application, such as strings, drawables, media, and
device configuration details. The most important class for accessing this data is Resources.
6.1.2 android.net.wifi.p2p
Provides classes to create peer-to-peer (P2P) connections with Wi-Fi Direct.
Using these APIs, you can discover and connect to other devices when each device supports Wi-Fi
Direct, then communicate over a speedy connection across distances much longer than a Bluetooth
connection. The primary class you need to work with is WifiP2pManager, which you can acquire by
calling getSystemService(WIFI_P2P_SERVICE). The WifiP2pManager includes APIs that allow you
to:
 Initialize your application for P2P connections by calling initialize()
 Discover nearby devices by calling discoverPeers()
 Start a P2P connection by calling connect()
6.1.3 android.os
Provides basic operating system services, message passing, and inter-process communication
on the device.
6.1.4 android.app
Contains high-level classes encapsulating the overall Android application model.
An Android application is defined using one or more of Android's four core application components.
Two such application components are defined in this package: Activity and Service. The other two
components are from the android.content package: BroadcastReceiver and ContentProvider.
6.1.5 android.media
Provides classes that manage various media interfaces in audio and video.
The Media APIs are used to play and, in some cases, record media files. This includes audio (e.g.,
play MP3s or other music files, ringtones, game sound effects, or DTMF tones) and video (e.g., play a
video streamed over the web or from local storage).
37
6.1.6 java.net
Provides the classes for implementing networking applications.
The java.net package can be roughly divided in two sections:
A Low Level API, which deals with the following abstractions:
Addresses, which are networking identifiers, like IP addresses.
Sockets, which are basic bidirectional data communication mechanisms.
Interfaces, which describe network interfaces.
A High Level API, which deals with the following abstractions:
URIs, which represent Universal Resource Identifiers.
URLs, which represent Universal Resource Locators.
Connections, which represents connections to the resource pointed to by URLs.
6.1.7 java.io
Provides for system input and output through data streams, serialization and the file system. Unless
otherwise noted, passing a null argument to a constructor or method in any class or interface in this
package will cause a NullPointerException to be thrown.
6.1.8 android.preference
Provides classes that manage application preferences and implement the preferences UI. Using these
ensures that all the preferences within each application are maintained in the same manner and the
user experience is consistent with that of the system and other applications.
6.1.9 android.widget
The widget package contains (mostly visual) UI elements to use on your Application screen. You can
also design your own.
To create your own widget, extend View or a subclass. To use your widget in layout XML, there are
two additional files for you to create
6.2 User created classes
6.2.1 Classes And Their Functions
 ChatActivity.java 
o onCreate() – Called when activity is created.
o onClick() – Handles the control of buttons for launching activities like review and
submit attendance.
o onResume() –Called when activity is resumed.
o onBackPressed() – Called when back button is pressed.
o onActivityResult(int, int, Intent) – Called when Intent is received back to an activity for
result.
o sendMessage(int) – Called to send a message of specific type.
o refreshList(Message, boolean) – Called to refresh the chat screen after receiving an
38
Image Message.
o copyTextToClipboard(long ) – Called to copy text to clipboard.
o shareMedia(long , int) – Called to share Media to various applications.
 Drawing Activity.java 
o onItemClick() – Handles the click of the list items of absent students for review.
o onItemChecked() – Triggered when an item is checked.
o paintClicked(View view) – Triggered when drawing is used.
o chooseBrush() – Called to choose Brush size.
o chooseEraser() – Called to choose Eraser size.
 FilePickerActivity.java 
o chooseFile(final Item) – Called to choose a file for sending.
o fillDirectory(File file) – Called to create different file hierarchy.
 MainActivity.java 

o onCreate(Bundle) – Called when activity is created.
o onCreateOptionsMenu(Menu) – Called to create Options Menu
o goToChat() – Called to go to Chat Screen.
o saveChatName(Context, String) – Called to save the chat name of User.
o loadChatName(Context context) – Called to load the chat name of User.
 MessageService.java 
o onStartCommand(Intent intent, int flags, int startId)– This is used when a message
activity is started.
 RecordActivity.java

o startRecording() – This is called when a recording of audio is started.
o stopRecording() – This is called when a recording of audio is stoped.
 ViewImage.java 
o Used to present and open a image which is received from user within the application.
 WebViewActivity.java 
o onReceivedTitle(WebView, String )– Used to open a specific link.
 ReceiveMessageClient.java 
o Void doInBackground(Void... params) – Used to read data from inputstream.
39
 ReceiveMessageServer.java 
o Void doInBackground(Void... params) – Prepares the inputstream for client
to receive data.
 SendMessageClient.java 
o Void doInBackground(Void... params) – Used to send data to outputstream.
 ReceiveMessageClient.java 
o Void doInBackground(Void... params) – Preapares data to be send to
outputstream.
 Image.java

o public Bitmap getBitmapFromUri()-retreive bitmap from its uri
o public Bitmap decodeSampleBitmapFromUrl(int width,int height)- loads
bitmap in size calculated

 MediaFile.java

o public byte[] fileToByteArray()- converts media file to byte array
o public String getRealPathFromURI(Context context,Uri contentUri)- Returns
path of file from uri
 Message.java

o public void saveByteArrayToFile(Context context)- saves the received
message bytes to a path according to the type of message

 WifiDirectBroadcastReceiver.java(Singleton Class)

o public void activateGoToChat(String role)- Starts the chat according to
role(server or client)
o public int isGroupOwner()- returns true if device is group owner
40
41
Chapter 7
Working
42
7.1 Start-up screen
The start screen is the connection establishment page where a user will be asked to join a Wi-
Fi Direct network if not connected
.
Fig. 7.1 - start-up screen
43
7.2 Connection Establishment Screen
The next screen is the connection establishment screen.
 One device has to request other to accept his request

 Other device has to accept the request for successful connection establishment. 

. 



Fig. 7.2 – connection establishment screen
44
7.3 User Screen
The next screen is the user screen.
 User sets a new name giving his/her details for first time.
 Automatically sets the name if previously set by user.
 User can change the user name on setup phase. 
Fig 7.3 – User screen
45
7.4 Chat Screen
1) Simple Text Messages:
 Sender is depicted in White Bubble
 Receiver is depicted in Blue Bubble.
 Size of Bubble in dynamic in nature which depends on size and length of
message to be sent
Fig 7.4 – Chat screen(Sending Of Text Messages)
46
7.5 Chat Screen
2) Selecting Options In Image Transfer:
 A pop up menu comes on touching image button
 Two Options Are Available:
o Pick Image from Gallery.
o Take Image from Camera.
Fig 7.5 – Chat screen (Picking Options For Image Transfer)
47
7.6 Chat Screen
3) Picking/Sending Image From Galley:
 On Selecting Pick Image, it goes to Gallery. 
 A File is selected and when clicked ,it is send
Fig 7.6 – Chat screen (Picking From Galley And Sending)
48
7.7 Chat Screen
4) Capturing Image From Camera And Sending:
 On Selecting Take Photo, it goes to Camera.
 On clicking Image it gives a preview of image is provided.
o It can be discarded or,
o It can be used to send to other user. 
Fig 7.7 – Chat screen (Capturing From Camera And Sending)
49
7.8 Chat Screen
5) Selecting Send Drawing Option:
 On Selecting send drawing option, it goes to Draw Activity.
 Can be used to:
o Send paintings.
o Send Smilies.
o Send any type of drawings.
  User can express its feelings better when there is no limitation of using static
smilies.


Fig 7.8 – Chat screen (An Interface for Drawing)
50
7.9 Chat Screen
6) Using Different Paint And Eraser Sizes:
 Different Paint Brushes are available.
 Different Eraser sizes are available.
 Total of three sizes of erasers/brushes are available.
 A total of 6 colours are available to be choose from.
Fig 7.9 – Chat screen (An Interface for Drawing)
51
7.10 Chat Screen
7) Making Drawings And Sending:
 Different Paint Brushes and colours can be used to make smilies, drawings etc.
 Click Save and Send button to send it instantaneously.
Fig 7.10 – Chat screen (Drawing smilies and sending)
52
7.11 Chat Screen
8) Recording And Sending Videos
 We can record videos of any length.
 After recording videos can be previewed and send it only if you want.
 Speed of 2-3 Mbps can be achieved.
Fig 7.11 – Chat screen (Drawing smilies and sending)
53
7.12 Chat Screen
9) Recording Voice Messages
 Same icons of different colour are used to depict whether it is recording or not.
 Blue Icon shows that it is recording.
 Red Icon shows that it stops recording.
Fig 7.12 – Chat screen (Recording Audio Messages)
54
7.13 Chat Screen
10)Previewing And Sending Voice Messages
 Audio Message recorded earlier can be previewed and we can listen the voice
again.
 The message can be discarded.
 On clicking tick button , the message can be sent.
Fig 7.13 – Chat screen (Previewing and Sending Audio Message)
55
7.14 Chat Screen
11)Sending Files From Phone Storage/ SD Card
 Any Attachment can be sent from SD/Phone memory.
 Attachment can be:
o PDF file
o Mp3,Mp4 file.
o .config file
o .os file
o Any type of file.
 On clicking file , the message can be sent.
Fig 7.14 – Chat screen (Selecting And Sending Files As Attachment)
56
7.15 Chat Screen
12)Copying/Sharing Text Messages in Chat
 Any Text Message can be copied to clipboard and can be used to copy it to
other applications.
 Text can share with multiple applications like
o Gmail
o Facebook
o Messenger (Facebook)
o Hangouts
Fig 7.15 – Chat screen (Sharing/Copying Text Messages to Other Applications)
57
7.16 Chat Screen
13)Sending And Opening Web Links
 Any type of web links can be send through the chat messages
 It is shown in blue colour with underlined.
 Presence of www is not necessary like google.com
 Web Links are opened in web activity within the application without any
browser
Fig 7.16 – Chat screen (Sending and Opening web links)
58
7.17Chat Screen
14)Calling And Saving Mobile Numbers in Chat
 Any type of mobile number can be send through the chat messages
 It is shown in blue colour with underlined.
 Number can be saved or called using truecaller /default caller etc applications
directly
Fig 7.17 – Chat screen (Calling And Saving Mobile Numbers)
59
7.18 Chat Screen
15)Warning Message On Closing Application
 This application doesn’t used any type of messages.
 Once messages are deleted ,they cannot be retrieved.
 So the user must be aware of such action ,which can be made aware by showing
a pop up warning message.
Fig 7.18 – Chat screen (Warning Message)
60
7.19 Download Folder
 All the media and files which are received by user are stored in the Download
folder (preference is SD Card).
 In case of Samsung mobile phones, it is stored in phone memory.


Fig 7.19 – Downloads Folder
61
62
Chapter8
Conclusion and Future Scope
63
8.1 Problems with Wi-Fi Direct:
The problems we have observed while developing the application are that
 Wi-Fi Direct is still an emerging technology.
 How many devices can connect?
 A Wi-Fi Direct-certified network can be one-to-one, or one to-many. The
number of devices in a Wi-Fi Direct-certified group network is expected to be
smaller than the number supported by traditional standalone access points
intended for consumer use. Connection to multiple other devices is an
optional feature that will not be supported in all Wi-Fi Direct-certified
devices; some devices will only make 1:1 connections.
 Connection to multiple other devices is an optional feature that will not be
supported in all Wi-Fi Direct-certified devices; some devices will only make
1:1 connections.
 Wi-Fi Direct-certified devices will be identifiable as Wi-Fi Direct-certified
devices to infrastructure access points. APs can prevent devices currently
using Wi-Fi Direct from connecting to the AP, or disconnect them if already
connected, while Wi-Fi Direct is in use and/or configure their parameters
including channel.
 Several Wi-Fi Alliance members that make devices of limited processing
capabilities contributed to the specification development process to ensure
that it is applicable to such devices.
 Bluetooth and Wi-Fi Interference Cases . A Wi-Fi receiver senses a Bluetooth
signal at the same time a Wi-Fi signal is being sent to it. The effect is most
pronounced when the Bluetooth signal is within the 22-MHzwide pass band
of the Wi-Fi receiver.
 A Bluetooth receiver senses a Wi-Fi signal at the same time a Bluetooth
signal is being sent to it; the effect is most pronounced when the Wi-Fi signal
is within the pass band of the Bluetooth receiver
These problems have caused a major hindrance in the development of the application.
8.2 Conclusion
 This document has discussed techniques used, why they were used and the detailed
working of the application.
 The main work is done on the interface which is very simple and is user friendly.
 This application can be used in any school/university as it does not have any
64
restriction. All the possible test cases have been tested for the bug free working
of the application.
 This needs no central server /database and only Wi-Fi enabled devices are required.
 Wi-Fi direct is made for temporarily connecting a few devices in an easy-to-use and
secure way, but it does not work well for larger network topologies.
 The major problem a user confronts when using the Wi-Fi direct is that the device
are not compatible with each other. The device crashes or gets stuck if we try to
exchange multimedia.
 The solution to overcome this problem is to develop the link layer and see that the
connection is still on when the exchange is going on. This Application would work
in a better way if there is device compatibility and Wi-Fi direct is extended to all
the smart devices.
 Finally, if Wi-Fi Direct becomes a widespread technology as expected, it faces the
challenge of improving coexistence.
8.3 Future Scope
There are various scopes for this application in future. Some of them can be as follows:
 This application can be further expanded to connect to multiple clients and be used
to transfer files to multiple clients at once.
 An alternative application can be used to create live streaming of videos within the
range of Wi-Fi.
 An alternative application can be used to create live voice calling feature within the
range of Wi-Fi. .
 Further improvements can be made regarding continuous file transfer speed of Wi-Fi
Direct.
 Different types of smilies like in WhatsApp ,Facebook can be included in it.
 There are several other factors that could give Wi-Fi Direct a much-needed boost in
the near future.
o The number of connected devices as a whole is on the rise, as manufacturers
seek to add IP connectivity to everything from cameras to tablets and TVs.
The Wi-Fi Alliance also threw its lot in with the Digital Living Network
Alliance (DLNA) last November, ensuring that DLNA certified devices now
also support Wi-Fi Direct.
o Wi-Fi Direct devices are still on the way. In-Stat predicts that every
connected device with Wi-Fi will ship with Wi-Fi Direct by 2014. Given that
Wi-Fi Direct devices are also backwards-compatible with other Wi-Fi
products that means a huge number of consumer electronics will be capable
of connecting over local wireless networks without the Internet. Only one
device in each wireless pairing has to be Wi-Fi Direct-enabled.
65
8.4 References
Books
[1]. James Steel and Nelson To, Android Developers Cookbook, Pearson
Education, 2011.
[2]. Donn Felker with Joshua Dobbs, Android Application Development For
Dummies, Wiley Publishing, Inc.
[3]. Lucas Jordan and Pieter Greyling, Practical Android Projects, Apress Publication.
[4]. Marko Gargenta, Learning Android, O’REILLY Publication.
[5]. Reto Meier, Professional Android Application Development, Wiley Publishing Inc.
[6]. Frank Ableson, Charlie Collins and Robi Sen, Unlocking Android, Manning
Publication Co.
World Wide Web
[7]. Android Developers, http://developer.android.com/develop/index.html, 4th
October,
2013.
[8]. How to switch between intents, http://www.androidhive.info/2011/08/ 23rd
November, 2013.
[9]. Android related questions, http://www.stackoverflow.com
[10]. Eclipse, Android and Java training and support,
http://www.vogella.com/.
[11]. Beginning Java forum, http://www.coderanch.com/
[12]. http://www.wi-fi.org/files/faq_20101021_Wi-Fi_Direct_FAQ.pdf
[13]. http://anrg.usc.edu/ee579_2012/Group09/#wifidirect
[14] http://developer.android.com/guide/topics/connectivity/wifip2p.html

Contenu connexe

Tendances

Introduction to android
Introduction to androidIntroduction to android
Introduction to androidzeelpatel0504
 
Introduction to Android development - Presentation Report
Introduction to Android development - Presentation ReportIntroduction to Android development - Presentation Report
Introduction to Android development - Presentation ReportAtul Panjwani
 
Mobile operating system..
Mobile operating system..Mobile operating system..
Mobile operating system..Aashish Uppal
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development pptGautam Kumar
 
Presentation on Android
Presentation on AndroidPresentation on Android
Presentation on AndroidNausad Ahamed
 
Sistema Operativo. android
Sistema Operativo. androidSistema Operativo. android
Sistema Operativo. androidnavarrocar
 
android technology presentation
android technology presentationandroid technology presentation
android technology presentationNishul Tomar
 
Presentation on android
Presentation on androidPresentation on android
Presentation on androidsonyhontok
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App DevelopmentMike Kvintus
 
Android vs Others Operating System
Android vs Others Operating SystemAndroid vs Others Operating System
Android vs Others Operating SystemShemul Hossain
 
Comparative Study On Mobile Operating Systems
  Comparative Study On Mobile Operating Systems   Comparative Study On Mobile Operating Systems
Comparative Study On Mobile Operating Systems Hardik Jain
 
Anshul chechani android app development report
Anshul chechani android app development reportAnshul chechani android app development report
Anshul chechani android app development reportAnshul Chechani
 
Intelligent Weather Service
Intelligent Weather Service Intelligent Weather Service
Intelligent Weather Service Uday Sharma
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentAly Abdelkareem
 
Android OS Presentation
Android OS PresentationAndroid OS Presentation
Android OS PresentationEks Dhiee ジ
 

Tendances (20)

Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Introduction to Android development - Presentation Report
Introduction to Android development - Presentation ReportIntroduction to Android development - Presentation Report
Introduction to Android development - Presentation Report
 
Android OS 2019
Android OS 2019Android OS 2019
Android OS 2019
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Mobile operating system..
Mobile operating system..Mobile operating system..
Mobile operating system..
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development ppt
 
Bluetooth Chat
Bluetooth ChatBluetooth Chat
Bluetooth Chat
 
Presentation on Android
Presentation on AndroidPresentation on Android
Presentation on Android
 
PPT on Android
PPT on AndroidPPT on Android
PPT on Android
 
Sistema Operativo. android
Sistema Operativo. androidSistema Operativo. android
Sistema Operativo. android
 
android technology presentation
android technology presentationandroid technology presentation
android technology presentation
 
Presentation on android
Presentation on androidPresentation on android
Presentation on android
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App Development
 
Android vs Others Operating System
Android vs Others Operating SystemAndroid vs Others Operating System
Android vs Others Operating System
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Comparative Study On Mobile Operating Systems
  Comparative Study On Mobile Operating Systems   Comparative Study On Mobile Operating Systems
Comparative Study On Mobile Operating Systems
 
Anshul chechani android app development report
Anshul chechani android app development reportAnshul chechani android app development report
Anshul chechani android app development report
 
Intelligent Weather Service
Intelligent Weather Service Intelligent Weather Service
Intelligent Weather Service
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android OS Presentation
Android OS PresentationAndroid OS Presentation
Android OS Presentation
 

Similaire à Wifi Direct Based Chat And File Transfer Android Application

Android : Architecture & Components
Android : Architecture & ComponentsAndroid : Architecture & Components
Android : Architecture & ComponentsAkash Bisariya
 
Android 1-intro n architecture
Android 1-intro n architectureAndroid 1-intro n architecture
Android 1-intro n architectureDilip Singh
 
Ch1 hello, android
Ch1 hello, androidCh1 hello, android
Ch1 hello, androidJehad2012
 
Android architecture
Android architectureAndroid architecture
Android architecturepoojapainter
 
Getting started with android
Getting started with androidGetting started with android
Getting started with androidamitgb
 
architecture of android.pptx
architecture of android.pptxarchitecture of android.pptx
architecture of android.pptxallurestore
 
Android : Revolutionizing Mobile Devices
Android : Revolutionizing Mobile DevicesAndroid : Revolutionizing Mobile Devices
Android : Revolutionizing Mobile DevicesRitesh Puthran
 
Android seminar-report-body.doc
Android seminar-report-body.docAndroid seminar-report-body.doc
Android seminar-report-body.docDeepak Yadav
 
Android- Introduction for Beginners
Android- Introduction for BeginnersAndroid- Introduction for Beginners
Android- Introduction for BeginnersTripti Tiwari
 
Phonebook Directory or Address Book In Android
Phonebook Directory or Address Book In AndroidPhonebook Directory or Address Book In Android
Phonebook Directory or Address Book In AndroidABHISHEK DINKAR
 
Outstanding Improvement Award Outstanding Improvement Award
Outstanding Improvement Award Outstanding Improvement AwardOutstanding Improvement Award Outstanding Improvement Award
Outstanding Improvement Award Outstanding Improvement Awardpravinmali2191
 
Android architecture
Android architectureAndroid architecture
Android architecturefahim shahzad
 
01 what is android
01 what is android01 what is android
01 what is androidC.o. Nieto
 
Android..overwiew
Android..overwiewAndroid..overwiew
Android..overwiewSai Teja
 

Similaire à Wifi Direct Based Chat And File Transfer Android Application (20)

Android : Architecture & Components
Android : Architecture & ComponentsAndroid : Architecture & Components
Android : Architecture & Components
 
Android 1-intro n architecture
Android 1-intro n architectureAndroid 1-intro n architecture
Android 1-intro n architecture
 
Ch1 hello, android
Ch1 hello, androidCh1 hello, android
Ch1 hello, android
 
Android
AndroidAndroid
Android
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android
Android Android
Android
 
Getting started with android
Getting started with androidGetting started with android
Getting started with android
 
architecture of android.pptx
architecture of android.pptxarchitecture of android.pptx
architecture of android.pptx
 
Android primer
Android primerAndroid primer
Android primer
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android Introduction by Kajal
Android Introduction by KajalAndroid Introduction by Kajal
Android Introduction by Kajal
 
Android : Revolutionizing Mobile Devices
Android : Revolutionizing Mobile DevicesAndroid : Revolutionizing Mobile Devices
Android : Revolutionizing Mobile Devices
 
Android seminar-report-body.doc
Android seminar-report-body.docAndroid seminar-report-body.doc
Android seminar-report-body.doc
 
Android- Introduction for Beginners
Android- Introduction for BeginnersAndroid- Introduction for Beginners
Android- Introduction for Beginners
 
Phonebook Directory or Address Book In Android
Phonebook Directory or Address Book In AndroidPhonebook Directory or Address Book In Android
Phonebook Directory or Address Book In Android
 
Outstanding Improvement Award Outstanding Improvement Award
Outstanding Improvement Award Outstanding Improvement AwardOutstanding Improvement Award Outstanding Improvement Award
Outstanding Improvement Award Outstanding Improvement Award
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android apps
Android appsAndroid apps
Android apps
 
01 what is android
01 what is android01 what is android
01 what is android
 
Android..overwiew
Android..overwiewAndroid..overwiew
Android..overwiew
 

Dernier

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 

Dernier (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Wifi Direct Based Chat And File Transfer Android Application

  • 2. 2 1.1 What is Android ? Android is basically an operating system for smartphones. But we find now integrated into PDAs, Touch pads or televisions, even cars (trip computer) or netbooks. The OS was created by the start-up of the same name, which is owned by Google since 2005. 1.1.1 Specifications This operating system is based on version 2.6 of Linux, so it has a monolithic system kernel, what means that all system functions and drivers are grouped into one block of code. 1.1.2 Architecture Android consists of five layers: -The Linux kernel 2.6-which includes useful drivers that allow for example Wi-Fi or Bluetooth. -The library written in C and C + + that provide higher level functionality such as an HTML engine, or a database (SQLite). -A runtime environment for applications based on a virtual machine, made for inefficient machines such as telephones. The aim is to translate JAVA in machine language understood by Android. -A JAVA framework that allows applications running on the virtual machine to organize and cooperate. -The user applications written in Java (Web browser, contact manager etc.). 1.2 Understanding the Android Software Stack The Android software stack is composed of the elements shown in Figure 1-1 and described in further detail below it. Put simply, a Linux kernel and a collection of C/C++ libraries are exposed through an application framework that provides services for, and management of, the run time and applications.
  • 3. 3 Figure 1.1- Android Software Stack 1.2.1 Linux Kernel Core services (including hardware drivers, process and memory management, security, network, and power management) are handled by a Linux 2.6 kernel. The kernel also provides an abstraction layer between the hardware and the remainder of the stack. 1.2.2 Libraries Running on top of the kernel, Android includes various C/C++ core libraries such as libc and SSL, as well as: A media library for playback of audio and video media A Surface manager to provide display management Graphics libraries that include SGL and OpenGL for 2D and 3D graphics SQLite for native database support SSL and WebKit for integrated web browser and Internet security 1.2.3 Android Run Time What makes an Android phone an Android phone rather than a mobile Linux implementation is the Android run time. Including the core libraries and the Dalvik virtual machine, the Android run time is the engine that powers your applications and, along with the libraries, forms the basis for the application framework.
  • 4. 4 1.2.4 Core Libraries While Android development is done in Java, Dalvik is not a Java VM. The core Android libraries provide most of the functionality available in the core Java libraries as well as the Android-specific libraries. 1.2.5 Dalvik Virtual Machine Dalvik is a register-based virtual machine that‘s been optimized to ensure that a device can run multiple instances efficiently. It relies on the Linux kernel for threading and low-level memory management. 1.2.6 Application Framework The application framework provides the classes used to create Android applications. It also provides a generic abstraction for hardware access and manages the user interface and application resources. 1.2.7 Application Layer All applications, both native and third party, are built on the application layer using the same API libraries. The application layer runs within the Android run time using the classes and services made available from the application framework 1.3 The Dalvik Virtual Machine One of the key elements of Android is the Dalvik virtual machine. Rather than use a traditional Java virtual machine (VM) such as Java ME (Java Mobile Edition), Android uses its own custom VM designed to ensure that multiple instances run efficiently on a single device. The Dalvik VM uses the device‘s underlying Linux kernel to handle low-level functionality including security, threading, and process and memory management. It‘s also possible to write C/C++ applications that run directly on the underlying Linux OS. While you can do this, in most cases there‘s no reason you should need to. All Android hardware and system service access is managed using Dalvik as a middle tier. By using a VM to host application execution, developers have an abstraction layer that ensures they never have to worry about a particular hardware implementation. The Dalvik VM executes Dalvik executable files, a format optimized to ensure minimal memory footprint. The .dex executable is created by transforming Java language compiled classes using the tools supplied within the SDK.
  • 5. 5 1.4 Android Application Architecture Android‘s architecture encourages the concept of component reuse, allowing you to publish and share activities, services, and data with other applications with access managed by the security restrictions you put in place. The same mechanism that lets you produce a replacement contact manager or phone dialer can let you expose your application components to let other developers create new UI front ends and functionality extensions, or otherwise build on them. The following application services are the architectural cornerstones of all Android applications, providing the framework you‘ll be using for your own software:  Activity Manager Controls the life cycle of your activities, including management of the activity Stack.   Views Are used to construct the user interfaces for your activities.   Notification Manager Provides a consistent and non-intrusive mechanism for signalling your Users.  Content Providers Lets your applications share data between applications.   Resource Manager Supports non-code resources like strings and graphics to be externalized. 1.5 Android Libraries Android offers a number of APIs for developing your applications. The following list of core APIs should provide an insight into what‘s available; all Android devices will offer support for at least these APIs:  android.util The core utility package contains low-level classes like specialized containers, string formatters, and XML parsing utilities.    android.os The operating system package provides access to basic  operating System services like message passing, interprocess communication, clock functions  android.graphics The graphics API supplies the low-level graphics classes that support canvases,colors, and drawing primitives, and lets you draw on canvases.    android.text The text processing tools for displaying and parsing text.     android.database Supplies the low-level classes required for handling cursors when working with databases. 
  • 6. 6  android.content The content API is used to manage data access and publishing by providing services for dealing with resources, content providers, and packages.      android.view Views are the core user interface class. All user interface elements are constructed using a series of Views to provide the user interaction components.     android.widget Built on the View package, the widget classes are the ―here‘s one we created earlier‖ user-interface elements for you to use in your applications. They include lists, buttons, and layouts.     com.google.android.maps A high-level API that provides access to native map controls that you can use within your application. Includes the MapView control as well as the Overlay and MapController classes used to annotate and control your embedded maps.    android.app A high-level package that provides access to the application model. The application package includes the Activity and Service APIs that form the basis for all your Android applications.     android.provider To ease developer access to certain standard Content Providers (such as the contacts database), the Provider package offers classes to  provide access to standard databases included in all Android distributions.  android.telephony The telephony APIs give you the ability to directly interact with the device‘s phone stack, letting you make, receive, and monitor phone calls, phone status, and SMS messages.  android.webkit The WebKit package features APIs for working with Web- based  content, including a WebView control for embedding browsers in your activities and a cookie manager.  In addition to the Android APIs, the Android stack includes a set of C/C++ libraries that are exposed through the application framework. These libraries include:     1.6 Advanced Android Libraries The core libraries provide all the functionality you need to start creating applications for Android, but it won‘t be long before you‘re ready to delve into the advanced APIs that offer the really exciting functionality. Android hopes to target a wide range of mobile hardware, so be aware that the suitability and implementation of the following APIs will vary depending on the device upon which they are implemented. 
  • 7. 7    android.location The location-based services API gives your applications  access to the devices current physical location. Location-based services provide generic access to location information using whatever position-fixing hardware or technology is available on the device.  android.media The media APIs provide support for playback and recording of audio and video media fi les, including streamed media.     android.opengl Android offers a powerful 3D rendering engine using the OpenGL ES API that you can use to create dynamic 3D user interfaces for your applications.     android.hardware Where available, the hardware API exposes sensor hardware including the camera, accelerometer, and compass sensors    android.bluetooth android.net.wifi , and android.telephony Android also  provides low-level access to the hardware platform, including Bluetooth, Wi-Fi, and telephony hardware 1.7 Android and Java In Java, you write your Java source file, compile it into a Java byte code using the Java compiler, and then run this byte code on the Java VM. In Android, things are different. You still write the Java source file, and you still compile it to Java byte code using the same Java compiler. But at that point, you recompile it once again using the Dalvik compiler to Dalvik byte code. It is this Dalvik byte code that is then executed on the Dalvik VM. Figure illustrates this comparison between standard Java (on the left) in Android using Dalvik (on the right). Figure 1.2 Java Versus Dalvik
  • 8. 8 You may wonder, why not compile straight from Java into the Dalvik byte code? There are a couple of good reasons for the extra steps. Back in 2005, when work on Dalvik started, the Java language was going through frequent changes, but the Java byte code was more or less set in stone. So, the Android team chose to base Dalvik on Java byte code instead of Java source code. A side effect of this is that in theory you could write Android applications in any other language that compiles down to Java byte code. For example, you could use Python or Ruby. I say ―in theory‖ because in practice the appropriate libraries that are part of the SDK would need to be available. But it is likely that the open source community will come up with a solution to that in the future. Another thing to keep in mind is that Android Java is a nonstandard collection of Java classes. Java typically ships in: -Java Standard Edition Used for development on basic desktop-type applications -Java Enterprise Edition (aka J2EE or JavaEE) Used for development of enterprise applications -Java Micro Edition (aka J2ME or JavaME) -Java for mobile applications Android‘s Java set of libraries is closest to Java Standard Edition. The major difference is that Java user interface libraries (AWT and Swing) have been taken out and replaced with Android-specific user interface libraries. Android also adds quite a few new features to standard Java while supporting most of Java‘s standard features. So, you have most of your favourite Java libraries at your disposal, plus manynew ones. 1.8 Application Framework The application framework is a rich environment that provides numerous services to help you, the app developer, get your job done. This is the best-documented and most extensively covered part of the platform because it is this layer that empowers developers to get creative and bring fantastic applications to the market. In the application framework layer, you will find numerous Java libraries specifically built for Android. You will also find many services (or managers) that provide the eco-system of capabilities your application can tap into, such as location, sensors, WiFi,telephony, and so on.
  • 9. 9 1.9 Android Version Android 5.0 - Lollipop Fig 1.3 -Lollipop Android 5.0 "Lollipop" was unveiled under the codename "Android L" on June 25, 2014, during Google I/O. It became available as official over-the-air (OTA) updates on November 12, 2014, for select devices that run distributions of Android serviced by Google, including Nexus and Google Play edition devices. Its source code was made available on November 3, 2014.Lollipop features a redesigned user interface built around a responsive design language referred to as "material design". Other changes include improvements to the notifications, which can be accessed from the lockscreen and displayed within applications as top-of-the- screen banners. Furthermore, Google made internal changes to the platform, with the Android Runtime (ART) officially replacing Dalvik for improved application performance, and with changes intended to improve and optimize battery usage, known internally as Project Volta Android 4.4 - KitKat Figure 1.4 – KitKat Google announced Android 4.4 KitKat on September 3, 2013. Although initially under the "Key Lime Pie" ("KLP") codename, the name was changed because "very few people actually know the taste of a key lime pie."[129] Some technology bloggers also expected the "Key Lime Pie" release to be Android 5.[130] KitKat debuted on Google's Nexus 5 on October 31, 2013, and was optimised to run on a greater range of devices than earlier Android versions, having 512 MB of RAM as a recommended minimum; those improvements were known as "Project Svelte" internally at Google.[131] The required minimum amount of RAM available to Android is 340 MB, and all devices with less than 512 MB of RAM must report themselves as "low RAM" devices.
  • 10. 10 Android 4.1-4.3 - Jelly Bean Figure 1.5 – Jelly Bean Jelly Bean arrived at Google IO 2012, with the release of the ASUS Nexus 7, followed by a quick update for unlocked Galaxy Nexus phones. Later in the year, the release of the Nexus 10 and Nexus 4 updated things from 4.1 to 4.2 and on to 4.3, but the version remained Jelly Bean. The release polished the UI design started in Ice Cream Sandwich, and brought several great new features to the table. Besides the new focus on responsiveness with Project Butter, Jelly Bean brings multi-user accounts, actionable notifications, lock screen widgets, quick-settings in the notification bar, Photosphere to the "stock" Android camera and Google Now. Jelly Bean is hailed by many as the turning point for Android, where all the great services and customization options finally meet great design guidelines. It's certainly very visually pleasing, and we'd argue that it's become one of the nicest looking mobile operating systems available. Android 4.0 - Ice Cream Sandwich Figure 1.6 – Ice Cream Sandwich The follow-up to Honeycomb was announced at Google IO in May 2011 and released in December 2011. Dubbed Ice Cream Sandwich and finally designated Android 4.0, Ice
  • 11. 11 Cream Sandwich brings many of the design elements of Honeycomb to smartphones, while refining the Honeycomb experience. The first device to launch with ICS was the Samsung Galaxy Nexus. 1.10Wifi-Direct 1.10.1 Introduction • Wi-Fi direct is new technology defined by the Wi-Fi alliance aimed at enhancing direct device to device communication without requiring a wireless access point. • Wi-Fi direct builds upon the successful IEEE 802.11 infrastructure mode and lets devices negotiate who will take over the AP-like functionalities. • Direct device to device connectivity was already possible in original IEEE 802.11 standard but it contains many drawbacks such as lack of power saving or extended QoS capabilities. • Wi-Fi device to device communication space is 802.11z, also known as Tunneled Direct Link Setup (TDLS), which enables direct device to device communication but requires station to associate with the same AP. 1.10.2 Technical Overview • In a typical Wi-Fi network, client scans and associate to wireless networks available, which are created and announced by Access Points (AP). • Wi-Fi Direct is that these roles are specified as dynamic, and hence a Wi-Fi Direct device has to implement both the role of a client and the role of an AP. • These roles are therefore logical roles that could even be executed simultaneously by the same device, this type of operation is called Concurrent mode. • 1.10.3 Architecture • Wi-Fi direct device communicate by establishing P2P group. • The device implementing AP-like functionality in P2P group is referred to as the P2P Group Owner (P2P GO), and device acting as client are known as P2P clients. • Once P2P group is established, other P2P clients can join the group as in a traditional Wi-Fi network. • When the device act as both as P2P client and as P2P GO the device will typically alternate between the two roles by time-sharing the Wi-Fi interface.(Example: Laptop 2 in upper fig.) • Like a traditional AP, a P2P GO announces itself through beacons, and has to support power saving for its associated clients. • Only the P2P GO is allowed to cross-connect the devices in its P2P group to an external network (Example: Mobile in upper fig.)
  • 12. 12 • This connection must be done at network layer, typically implemented using Network Address Translation (NAT). • Wi-Fi direct does not allow transferring the role of P2P GO within the group. Figure 1.7 – Wifi Direct Architecture 1.10.4 Group Formation • Three types of group formation techniques are Standard, Autonomous and Persistent cases. • Group Formation procedure involves two phases-  Determination of P2P Group owner  Negotiated - Two P2P devices negotiate for P2P group owner based on desire/capabilities to be a P2P GO  Selected - P2P group Owner role established at formation or at an application level  Provisioning of P2P Group  Establishment of P2P group session using appropriate credentials  Using Wi-Fi simple configuration to exchange credentials. • Standard: In this case the P2P device have to discover each other, and then negotiate which device will act as P2P GO. • Its start by performing a traditional Wi-Fi scan, by means of which they can discover existent groups and Wi-Fi network.
  • 13. 13 • To prevent conflicts when two devices declare the same GO Intent, a tie-breaker bit is included in the GO Negotiation Request, which is randomly set every time a GO Negotiation Request is sent. Figure 1.8 – Group Formation in Wifi Direct • Autonomous: A P2P device may autonomously create a P2P group, where it immediately becomes the P2P GO, by sitting on a channel and starting a beacon. • Other devices can discover the established group using traditional scanning mechanisms. • As compared to previous case, the discovery phase is simplified in this case as the device establishing the group does not alternate between states, and indeed no GO negotiation phase is required. • Persistent: In this process, P2P device can declare a group as persistent, by using flag in the P2P capabilities attribute present in beacon frames. • After the discovery phase, if a P2P device recognizes to have formed a persistent group with the corresponding peer in the past, any of the two P2P devices can use the Invitation Procedure to quickly re-instantiate the group. 1.10.5 Security • Wi-Fi Direct devices are required to implement Wi-Fi Protected Setup (WPS) to support a secure connection with minimal user intervention. • WPS allows establishing a secure connection by introducing a PIN in the P2P Client, or pushing a button in the two P2P Devices. • Following WPS terminology, the P2P GO is required to implement an internal Registrar, and the P2P Client is required to implement an Enrollee. • The operation of WPS is composed of two parts. In the first part, the internal Registrar is in charge of generating and issuing the network credentials, i.e., security keys, to the Enrollee.
  • 14. 14 • In the second part, the Enrollee (P2P Client) disassociates and reconnects using its new authentication credentials. 1.10.6 Power Saving • Wi-Fi Direct defines two new power saving mechanisms: the Opportunistic Power Save protocol and the Notice of Absence (NOA) protocol. • Opportunistic Power Save protocol (OPS) allows a P2P GO to save power when all its associated clients are sleeping. • The P2P Group Owner can only save power when all its clients are sleeping. Figure 1.9 – Power Saving in Wifi Direct • Notice of absence protocol (NOA) allows a P2P GO to announce time intervals, referred to as absence periods, where P2P Clients are not allowed to access the channel. • P2P GO defines a NOA schedule using four parameters:  Duration that specifies the length of each absence period  Interval that specifies the time between consecutive absence periods  Time that specifies the start time of the first absence period after the current Beacon frame  Count that specifies how many absence periods will be scheduled during the current NOA schedule.
  • 15. 15 Fig 1.10- NOA protocol in Wifi Direct 1.10.7 Benefits  Some of the benefits consumers will see from Wi-Fi Direct devices.  Mobility & Portability: Wi-Fi Direct-certified devices connect anytime, anywhere.  Immediate Utility: Users have the ability to create direct connections with the very first Wi-Fi Direct-certified device they bring home. For example, a new laptop certified for Wi-Fi Direct can create direct connections with the existing legacy Wi-Fi devices in the user’s home.  Ease of Use: Wi-Fi Direct devices have features that allow users to identify available devices and services before establishing a connection.  Simple Secure Connections: Wi-Fi Protected Setup makes it simple to create security- protected connections between devices. Users in most cases will be able to connect at the push of a button. 1.10.8 Conclusions • Wi-Fi alliance has recently developed the Wi-Fi Direct technology that builds upon the Wi-Fi infrastructure mode to enable direct device to device connectivity. • In this article we presented a thorough overview of the novel technical features specified in Wi-Fi Direct, following by the group formation, and other performance analysis such as power saving and security in this device. • The NOA protocol could also be re-used to virtualize the roles of P2P GO/Client over multiple concurrent P2P Groups. • Concurrent operation together with dynamic nature of the P2P GO/Client roles could be used to improve performance in dense environments, for instance by means of dynamic relays.
  • 16. 16
  • 18. 18 The true appeal of Android as a development environment lays in the APIs it provides. As an application-neutral platform, Android gives you the opportunity to create applications that are as much a part of the phone as anything provided out of the box. The following list highlights some of the most noteworthy Android features:  No licensing, distribution, or development fees or release approval processes.  Wi-Fi hardware access.     GSM, EDGE, and 3G networks for telephony or data transfer, enabling you to make or receive calls or SMS messages, or to send and retrieve data across mobile networks.    Comprehensive APIs for location-based services such as GPS.     Full Multimedia hardware control, including playback and recording with the camera and microphone.    APIs for using sensor hardware, including accelerometers and the compass.    Libraries for using Bluetooth for peer-to-peer data transfer.    IPC message passing.    Shared data stores.    Background applications and processes.    Home-screen Widgets, Live Folders, and Live Wallpaper.    The ability to integrate application search results into the system search.    An integrated open-source HTML5 Web Kit-based browser.     Full support for applications that integrate map controls as part of their user interface.     Mobile-optimized hardware-accelerated graphics, including a path-based 2Dgraphics library and support for 3D graphics using OpenGL ES 2.0 
  • 19. 19
  • 21. 21 As a user navigates through, out of, and back to your app, the Activity instances in your app transition between different states in their lifecycle. For instance, when your activity starts for the first time, it comes to the foreground of the system and receives user focus. During this process, the Android system calls a series of lifecycle methods on the activity in which you set up the user interface and other components. If the user performs an action that starts another activity or switches to another app, the system calls another set of lifecycle methods on your activity as it moves into the background (where the activity is no longer visible, but the instance and its state remains intact). Within the lifecycle callback methods, you can declare how your activity behaves when the user leaves and re-enters the activity. For example, if you're building a streaming video player, you might pause the video and terminate the network connection when the user switches to another app. When the user returns, you can reconnect to the network and allow the user to resume the video from the same spot. This class explains important lifecycle callback methods that each Activity instance receives and how you can use them so your activity does what the user expects and does not consume system resources when your activity doesn't need them. 3.1 Starting an Activity: Unlike other programming paradigms in which apps are launched with a main() method, the Android system initiates code in an Activity instance by invoking specific callback methods that correspond to specific stages of its lifecycle. There is a sequence of callback methods that start up an activity and a sequence of callback methods that tear down an activity. This lesson provides an overview of the most important lifecycle methods and shows you how to handle the first lifecycle callback that creates a new instance of your activity. 3.2 Understand the Lifecycle During the life of an activity, the system calls a core set of lifecycle methods in a sequence similar to a step pyramid. That is, each stage of the activity lifecycle is a separate step on the pyramid. As the system creates a new activity instance, each callback method moves the activity state one step toward the top. The top of the pyramid is the point at which the activity is running in the foreground and the user can interact with it. As the user begins to leave the activity, the system calls other methods that move the activity state back down the pyramid in order to dismantle the activity. In some cases, the activity will move only part way down the pyramid and wait (such as when the user switches to another app), from which point the activity can move back to the top (if the user returns to the activity) and resume where the user left off. Depending on the complexity of your activity, you probably don't need to implement all the lifecycle methods. However, it's important that you understand each one and implement those that ensure your app behaves the way users expect. Implementing your activity lifecycle methods properly ensures your app behaves well in several ways, including that it:
  • 22. 22 Does not crash if the user receives a phone call or switches to another app while using your app. Does not consume valuable system resources when the user is not actively using it. Figure 3.1-Android Lifecycle 3.3 Pausing and Resuming an Activity: During normal app use, the foreground activity is sometimes obstructed by other visual components that cause the activity to pause. For example, when a semi- transparent activity opens (such as one in the style of a dialog), the previous activity pauses. As long as the activity is still partially visible but currently not the activity in focus, it remains paused. However, once the activity is fully-obstructed and not visible, it stops (which is discussed in the next lesson). As your activity enters the paused state, the system calls the onPause() method on your Activity, which allows you to stop ongoing actions that should not continue while paused (such as a video) or persist any information that should be permanently saved in case the user continues to leave your app. If the user returns to your activity from the paused state, the system resumes it and calls the on Resume() method 3.4 Stopping and Restarting an Activity: Properly stopping and restarting your activity is an important process in the activity lifecycle that ensures your users perceive that your app is always alive and doesn't lose their progress. There are a few of key scenarios in which your activity is stopped and restarted: The user opens the Recent Apps window and switches from your app to another app. The activity in your app that's currently in the foreground is stopped. If the user returnsto your app from the Home screen launcher icon or the Recent Apps window, the activity restarts. The user performs an action in your app that starts a new activity. The current activity
  • 23. 23 is stopped when the second activity is created. If the user then presses the Back button, the first activity is restarted. The user receives a phone call while using your app on his or her phone. The Activity class provides two lifecycle methods, onStop() and onRestart(), which allow you to specifically handle how your activity handles being stopped and restarted. Unlike the paused state, which identifies a partial UI obstruction, the stopped state guarantees that the UI is no longer visible and the user's focus is in a separate activity (or an entirely separate app). 3.5 Recreating an Activity: There are a few scenarios in which your activity is destroyed due to normal app behavior, such as when the user presses the Back button or your activity signals its own destruction by calling finish(). The system may also destroy your activity if it's currently stopped and hasn't been used in a long time or the foreground activity requires more resources so the system must shut down background processes to recover memory. When your activity is destroyed because the user presses Back or the activity finishes itself, the system's concept of that Activity instance is gone forever because the behavior indicates the activity is no longer needed. However, if the system destroys the activity due to system constraints (rather than normal app behavior), then although the actual Activity instance is gone, the system remembers that it existed such that if the user navigates back to it, the system creates a new instance of the activity using a set of saved data that describes the state of the activity when it was destroyed. The saved data that the system uses to restore the previous state is called the "instance state" and is a collection of key- value pairs stored in a Bundle object. Caution: Your activity will be destroyed and recreated each time the user rotates the screen. When the screen changes orientation, the system destroys and recreates the foreground activity because the screen configuration has changed and your activity might need to load alternative resources (such as the layout). By default, the system uses the Bundle instance state to save information about each View object in your activity layout (such as the text value entered into an EditText object.. Figure 3.2- Recreating an activity
  • 24. 24
  • 26. 26 4.1 Overview of HTTP access on Android 4.1.1 Available official API's Android contains the standard Java network java.net package which can be used to access network resources. The base class for HTTP network access in the java.net package is the HttpUrlConnection class. 4.1.2 Required permissions To access the Internet your application requires the android.permission.INTERNET permission. To check the network state your application requires the android.permission.ACCESS_NETWORK_STATE permission. 4.1.3. Good practices for network access under Android Within an Android application you should avoid performing long running operations on the user interface thread. This includes file and network access. As of Android 3.0 (Honeycomb) the system is configured to crash with a NetworkOnMainThreadException exception, if network is accessed in the user interface thread. A typical setup for performing network access in a productive Android application is using a service. While it is possible to do network access from an activity or a fragment, using a service typical leads to a better overall design because you code in the activity becomes simpler. 4.2 Java and HTTP access Java provides a general-purpose, lightweight HTTP client API to access resources via the HTTP or HTTPS protocol. The main classes to access the Internet are the java.net.URL class and the java.net.HttpURLConnection class. The URL class can be used to define a pointer to a web resource while the HttpURLConnection class can be used to access a web resource. HttpURLConnection allows you to create an InputStream. Once you have accessed an InputStream you can read it similarly to an InputStream from a local file. In the latest version HttpURLConnection supports the transparent response compression (via the headerAccept- Encoding: gzip, Server Name Indication (extension of SSL and TLS) and a response cache. 4.3 Web Sockets Web Sockets are a standard based on HTTP for asynchronous message-based communication between a client and a server. To start a web socket communication, you create a HTTP GET request with a special HTTP headers. If the server accepts this request, the client and the server can send each other messages. Messages can be text or binary data and should be relatively small, as the web socket protocol is intended to be used with small payloads in the data. It is good practice to use JSON as data format for the messages.
  • 27. 27 4.4 AsyncTask 4.4.1Class-Overview AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers. AsyncTask is designed to be a helper class around Thread and Handler and does not constitute a generic threading framework. AsyncTasks should ideally be used for short operations (a few seconds at the most.) An asynchronous task is defined by a computation that runs on a background thread and whose result is published on the UI thread. An asynchronous task is defined by 3 generic types, called Params, Progress and Result, and 4 steps, called onPreExecute, doInBackground, onProgressUpdate and onPostExecute. 4.4.2Usage AsyncTask must be subclassed to be used. The subclass will override at least one method (doInBackground(Params...)), and most often will override a second one (onPostExecute(Result).) 4.4.3 The 4 steps When an asynchronous task is executed, the task goes through 4 steps:  onPreExecute(), invoked on the UI thread before the task is executed. This step is normally used to setup the task, for instance by showing a progress bar in the user interface.  doInBackground(Params...), invoked on the background thread immediately after onPreExecute() finishes executing. This step is used to perform background computation that can take a long time. The parameters of the asynchronous task are passed to this step. The result of the computation must be returned by this step and will be passed back to the last step. This step can also use publishProgress(Progress...) to publish one or more units of progress. These values are published on the UI thread, in the onProgressUpdate(Progress...) step.  onProgressUpdate(Progress...), invoked on the UI thread after a call to publishProgress(Progress...). The timing of the execution is undefined. This method is used to display any form of progress in the user interface while the background computation is still executing. For instance, it can be used to animate a progress bar or show logs in a text field.  onPostExecute(Result), invoked on the UI thread after the background computation finishes. The result of the background computation is passed to this step as a parameter. 4.4.4 Cancelling a task A task can be cancelled at any time by invoking cancel(boolean). Invoking this method will cause subsequent calls to isCancelled() to return true. After invoking this method, onCancelled(Object), instead of onPostExecute(Object) will be invoked after doInBackground(Object[]) returns. To ensure that a task is cancelled as quickly as possible,
  • 28. 28 you should always check the return value of isCancelled() periodically from doInBackground(Object[]), if possible (inside a loop for instance.) 4.4.5 Threading rules There are a few threading rules that must be followed for this class to work properly:  The AsyncTask class must be loaded on the UI thread. This is done automatically as of Jelly Bean.  The task instance must be created on the UI thread.  execute(Params...) must be invoked on the UI thread.  Do not call onPreExecute(), onPostExecute(Result), doInBackground(Params...), onProgressUpdate(Progress...) manually.  The task can be executed only once (an exception will be thrown if a second execution is attempted.) 4.4.6 Memory observability AsyncTask guarantees that all callback calls are synchronized in such a way that the following operations are safe without explicit synchronizations.  Set member fields in the constructor or onPreExecute(), and refer to them in doInBackground(Params...).  Set member fields in doInBackground(Params...), and refer to them in onProgressUpdate(Progress...) and onPostExecute(Result). 4.4.7 Order of execution When first introduced, AsyncTasks were executed serially on a single background thread. Starting with DONUT, this was changed to a pool of threads allowing multiple tasks to operate in parallel. Starting with HONEYCOMB, tasks are executed on a single thread to avoid common application errors caused by parallel execution. If you truly want parallel execution, you can invoke executeOnExecutor(java.util.concurrent.Executor, Object[]) with THREAD_POOL_EXECUTOR.
  • 29. 29
  • 31. 31 5.1 Environment 5.1.1 Eclipse IDE Eclipse is an integrated development environment (IDE). It contains a base workspace and an extensible plug-in system for customizing the environment. Written mostly in Java, Eclipse can be used to develop applications. By means of various plug-ins, Eclipse may also be used to develop applications in other programming languages PHP, Python, R, Ruby (including Ruby on Rails framework), Scala, Clojure, Groovy, Scheme, and Erlang. It can also be used to develop packages for the software Mathematica. Development environments include the Eclipse Java development tools (JDT) for Java and Scala, Eclipse CDT for C/C++ and Eclipse PDT for PHP, among others. The initial codebase originated from IBM VisualAge. [2] The Eclipse software development kit (SDK), which includes the Java development tools, is meant for Java developers. Users can extend its abilities by installing plug-ins written for the Eclipse Platform, such as development toolkits for other programming languages, and can write and contribute their own plug-in modules. Version Name Date Platform Projects version Callisto 30 June 2006 3.2 Callisto projects Europa 29 June 2007 3.3 Europa projects Ganymede 25 June 2008 3.4 Ganymede projects Galileo 24 June 2009 3.5 Galileo projects Helios 23 June 2010 3.6 Helios projects Indigo 22 June 2011 3.7 Indigo projects Juno 27 June 2012 3.8 and 4.2 Juno projects Kepler 26 June 2013 4.3 Kepler projects Luna 25 June 2014 4.4 Luna projects (planned) Mars 24 June 2015 4.5 Mars projects (planned) Table 5.1- Eclipse Versions With the exception of a small run-time kernel, everything in Eclipse is a plug-in. This means that every plug-in developed integrates with Eclipse in exactly the same way as other plug- ins; in this respect, all features are "created equal". Eclipse provides plug-ins for a wide variety of features, some of which are through third parties using both free and commercial models. Examples of plug-ins include for UML, for Sequence and other UML diagrams, a plug-in for DB Explorer, and many others.
  • 32. 32 5.2 Languages 5.2.1 Java Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another.  Java applications are typically compiled to bytecode (class file) that can run on any Java virtual machine(JVM) regardless of computer architecture.  Java is, as of 2014, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 9 million developers.    Java was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform.    The language derives much of its syntax from C and C++, but it has fewer low- level facilities than either of them.  Major release versions of Java, along with their release dates:  JDK 1.0 (January 21, 1996)    JDK 1.1 (February 19, 1997)    J2SE 1.2 (December 8, 1998)    J2SE 1.3 (May 8, 2000)    J2SE 1.4 (February 6, 2002)    J2SE 5.0 (September 30, 2004)    Java SE 6 (December 11, 2006)    Java SE 7 (July 28, 2011)    Java SE 8 (March 18, 2014)   5.2.2 Xml The design goals of XML emphasize simplicity, generality, and usability over the Internet. [6] It is a textual data format with strong support via Unicode for the languages of the world. Although the design of XML focuses on documents, it is widely used for the representation of arbitrary data structures, [7] for example in web services. Many application programming interfaces (APIs) developers with processing XML data, and several based languages have been developed to aid software exist to aid in the definition of XML-  
  • 33. 33 Key terminology The material in this section is based on the XML Specification. This is not an exhaustive list of all the constructs that appear in XML; it provides an introduction to the key constructs most often encountered in day-to-day use.  (Unicode) character By definition, an XML document is a string of characters. Almost every legal Unicode character may appear in an XML document.  Processor and application  The processor analyzes the markup and passes structured information to an application. The specification places requirements on what an XML processor must do and not do, but the application is outside its scope. The processor (as the specification calls it) is often referred to colloquially as an XML parser.  Markup and content  The characters making up an XML document are divided into markup and content, which may be distinguished by the application of simple syntactic rules. Generally, strings that constitute markup either begin with the character < and end with a >, or they begin with the character & and end with a ;. Strings of characters that are not markup are content. However, in a CDATAsection, the delimiters <![CDATA[ and ]]> are classified as markup, while the text between them is classified as content. In addition, whitespace before and after the outermost element is classified as markup.   Tag  A markup construct that begins with < and ends with >. Tags come in three flavors:  start-tags; for example: <section>   end-tags; for example: </section>   empty-element tags; for example: <line-break />     Element A logical document component which either begins with a start-tag and ends with a matching end-tag or consists only of an empty-element tag. The characters between the start- and end- tags, if any, are the element's content, and may contain markup, including other elements, which are called child elements. An example of an element is <Greeting>Hello, world.</Greeting>(see hello world). Another is <line-break />.
  • 34. 34
  • 36. 36 Two types of classes are being used in the application:  Built-in Packages- Packages which are available to developers by the sdk and the environment.    User created classes- Classes which are created by developers for certain special requirements in the working of application.    6.1 Built in packages 6.1.1 android.content Contains classes for accessing and publishing data on a device. It includes three main categories of APIs:  Content sharing (android.content) For sharing content between application components.  Package management (android.content.pm) For accessing information about an Android package (an .apk), including information about its activities, permissions, services, signatures, and providers. The most important class for accessing this information is PackageManager.  Resource management (android.content.res) For retrieving resource data associated with an application, such as strings, drawables, media, and device configuration details. The most important class for accessing this data is Resources. 6.1.2 android.net.wifi.p2p Provides classes to create peer-to-peer (P2P) connections with Wi-Fi Direct. Using these APIs, you can discover and connect to other devices when each device supports Wi-Fi Direct, then communicate over a speedy connection across distances much longer than a Bluetooth connection. The primary class you need to work with is WifiP2pManager, which you can acquire by calling getSystemService(WIFI_P2P_SERVICE). The WifiP2pManager includes APIs that allow you to:  Initialize your application for P2P connections by calling initialize()  Discover nearby devices by calling discoverPeers()  Start a P2P connection by calling connect() 6.1.3 android.os Provides basic operating system services, message passing, and inter-process communication on the device. 6.1.4 android.app Contains high-level classes encapsulating the overall Android application model. An Android application is defined using one or more of Android's four core application components. Two such application components are defined in this package: Activity and Service. The other two components are from the android.content package: BroadcastReceiver and ContentProvider. 6.1.5 android.media Provides classes that manage various media interfaces in audio and video. The Media APIs are used to play and, in some cases, record media files. This includes audio (e.g., play MP3s or other music files, ringtones, game sound effects, or DTMF tones) and video (e.g., play a video streamed over the web or from local storage).
  • 37. 37 6.1.6 java.net Provides the classes for implementing networking applications. The java.net package can be roughly divided in two sections: A Low Level API, which deals with the following abstractions: Addresses, which are networking identifiers, like IP addresses. Sockets, which are basic bidirectional data communication mechanisms. Interfaces, which describe network interfaces. A High Level API, which deals with the following abstractions: URIs, which represent Universal Resource Identifiers. URLs, which represent Universal Resource Locators. Connections, which represents connections to the resource pointed to by URLs. 6.1.7 java.io Provides for system input and output through data streams, serialization and the file system. Unless otherwise noted, passing a null argument to a constructor or method in any class or interface in this package will cause a NullPointerException to be thrown. 6.1.8 android.preference Provides classes that manage application preferences and implement the preferences UI. Using these ensures that all the preferences within each application are maintained in the same manner and the user experience is consistent with that of the system and other applications. 6.1.9 android.widget The widget package contains (mostly visual) UI elements to use on your Application screen. You can also design your own. To create your own widget, extend View or a subclass. To use your widget in layout XML, there are two additional files for you to create 6.2 User created classes 6.2.1 Classes And Their Functions  ChatActivity.java  o onCreate() – Called when activity is created. o onClick() – Handles the control of buttons for launching activities like review and submit attendance. o onResume() –Called when activity is resumed. o onBackPressed() – Called when back button is pressed. o onActivityResult(int, int, Intent) – Called when Intent is received back to an activity for result. o sendMessage(int) – Called to send a message of specific type. o refreshList(Message, boolean) – Called to refresh the chat screen after receiving an
  • 38. 38 Image Message. o copyTextToClipboard(long ) – Called to copy text to clipboard. o shareMedia(long , int) – Called to share Media to various applications.  Drawing Activity.java  o onItemClick() – Handles the click of the list items of absent students for review. o onItemChecked() – Triggered when an item is checked. o paintClicked(View view) – Triggered when drawing is used. o chooseBrush() – Called to choose Brush size. o chooseEraser() – Called to choose Eraser size.  FilePickerActivity.java  o chooseFile(final Item) – Called to choose a file for sending. o fillDirectory(File file) – Called to create different file hierarchy.  MainActivity.java   o onCreate(Bundle) – Called when activity is created. o onCreateOptionsMenu(Menu) – Called to create Options Menu o goToChat() – Called to go to Chat Screen. o saveChatName(Context, String) – Called to save the chat name of User. o loadChatName(Context context) – Called to load the chat name of User.  MessageService.java  o onStartCommand(Intent intent, int flags, int startId)– This is used when a message activity is started.  RecordActivity.java  o startRecording() – This is called when a recording of audio is started. o stopRecording() – This is called when a recording of audio is stoped.  ViewImage.java  o Used to present and open a image which is received from user within the application.  WebViewActivity.java  o onReceivedTitle(WebView, String )– Used to open a specific link.  ReceiveMessageClient.java  o Void doInBackground(Void... params) – Used to read data from inputstream.
  • 39. 39  ReceiveMessageServer.java  o Void doInBackground(Void... params) – Prepares the inputstream for client to receive data.  SendMessageClient.java  o Void doInBackground(Void... params) – Used to send data to outputstream.  ReceiveMessageClient.java  o Void doInBackground(Void... params) – Preapares data to be send to outputstream.  Image.java  o public Bitmap getBitmapFromUri()-retreive bitmap from its uri o public Bitmap decodeSampleBitmapFromUrl(int width,int height)- loads bitmap in size calculated   MediaFile.java  o public byte[] fileToByteArray()- converts media file to byte array o public String getRealPathFromURI(Context context,Uri contentUri)- Returns path of file from uri  Message.java  o public void saveByteArrayToFile(Context context)- saves the received message bytes to a path according to the type of message   WifiDirectBroadcastReceiver.java(Singleton Class)  o public void activateGoToChat(String role)- Starts the chat according to role(server or client) o public int isGroupOwner()- returns true if device is group owner
  • 40. 40
  • 42. 42 7.1 Start-up screen The start screen is the connection establishment page where a user will be asked to join a Wi- Fi Direct network if not connected . Fig. 7.1 - start-up screen
  • 43. 43 7.2 Connection Establishment Screen The next screen is the connection establishment screen.  One device has to request other to accept his request   Other device has to accept the request for successful connection establishment.   .     Fig. 7.2 – connection establishment screen
  • 44. 44 7.3 User Screen The next screen is the user screen.  User sets a new name giving his/her details for first time.  Automatically sets the name if previously set by user.  User can change the user name on setup phase.  Fig 7.3 – User screen
  • 45. 45 7.4 Chat Screen 1) Simple Text Messages:  Sender is depicted in White Bubble  Receiver is depicted in Blue Bubble.  Size of Bubble in dynamic in nature which depends on size and length of message to be sent Fig 7.4 – Chat screen(Sending Of Text Messages)
  • 46. 46 7.5 Chat Screen 2) Selecting Options In Image Transfer:  A pop up menu comes on touching image button  Two Options Are Available: o Pick Image from Gallery. o Take Image from Camera. Fig 7.5 – Chat screen (Picking Options For Image Transfer)
  • 47. 47 7.6 Chat Screen 3) Picking/Sending Image From Galley:  On Selecting Pick Image, it goes to Gallery.   A File is selected and when clicked ,it is send Fig 7.6 – Chat screen (Picking From Galley And Sending)
  • 48. 48 7.7 Chat Screen 4) Capturing Image From Camera And Sending:  On Selecting Take Photo, it goes to Camera.  On clicking Image it gives a preview of image is provided. o It can be discarded or, o It can be used to send to other user.  Fig 7.7 – Chat screen (Capturing From Camera And Sending)
  • 49. 49 7.8 Chat Screen 5) Selecting Send Drawing Option:  On Selecting send drawing option, it goes to Draw Activity.  Can be used to: o Send paintings. o Send Smilies. o Send any type of drawings.   User can express its feelings better when there is no limitation of using static smilies.   Fig 7.8 – Chat screen (An Interface for Drawing)
  • 50. 50 7.9 Chat Screen 6) Using Different Paint And Eraser Sizes:  Different Paint Brushes are available.  Different Eraser sizes are available.  Total of three sizes of erasers/brushes are available.  A total of 6 colours are available to be choose from. Fig 7.9 – Chat screen (An Interface for Drawing)
  • 51. 51 7.10 Chat Screen 7) Making Drawings And Sending:  Different Paint Brushes and colours can be used to make smilies, drawings etc.  Click Save and Send button to send it instantaneously. Fig 7.10 – Chat screen (Drawing smilies and sending)
  • 52. 52 7.11 Chat Screen 8) Recording And Sending Videos  We can record videos of any length.  After recording videos can be previewed and send it only if you want.  Speed of 2-3 Mbps can be achieved. Fig 7.11 – Chat screen (Drawing smilies and sending)
  • 53. 53 7.12 Chat Screen 9) Recording Voice Messages  Same icons of different colour are used to depict whether it is recording or not.  Blue Icon shows that it is recording.  Red Icon shows that it stops recording. Fig 7.12 – Chat screen (Recording Audio Messages)
  • 54. 54 7.13 Chat Screen 10)Previewing And Sending Voice Messages  Audio Message recorded earlier can be previewed and we can listen the voice again.  The message can be discarded.  On clicking tick button , the message can be sent. Fig 7.13 – Chat screen (Previewing and Sending Audio Message)
  • 55. 55 7.14 Chat Screen 11)Sending Files From Phone Storage/ SD Card  Any Attachment can be sent from SD/Phone memory.  Attachment can be: o PDF file o Mp3,Mp4 file. o .config file o .os file o Any type of file.  On clicking file , the message can be sent. Fig 7.14 – Chat screen (Selecting And Sending Files As Attachment)
  • 56. 56 7.15 Chat Screen 12)Copying/Sharing Text Messages in Chat  Any Text Message can be copied to clipboard and can be used to copy it to other applications.  Text can share with multiple applications like o Gmail o Facebook o Messenger (Facebook) o Hangouts Fig 7.15 – Chat screen (Sharing/Copying Text Messages to Other Applications)
  • 57. 57 7.16 Chat Screen 13)Sending And Opening Web Links  Any type of web links can be send through the chat messages  It is shown in blue colour with underlined.  Presence of www is not necessary like google.com  Web Links are opened in web activity within the application without any browser Fig 7.16 – Chat screen (Sending and Opening web links)
  • 58. 58 7.17Chat Screen 14)Calling And Saving Mobile Numbers in Chat  Any type of mobile number can be send through the chat messages  It is shown in blue colour with underlined.  Number can be saved or called using truecaller /default caller etc applications directly Fig 7.17 – Chat screen (Calling And Saving Mobile Numbers)
  • 59. 59 7.18 Chat Screen 15)Warning Message On Closing Application  This application doesn’t used any type of messages.  Once messages are deleted ,they cannot be retrieved.  So the user must be aware of such action ,which can be made aware by showing a pop up warning message. Fig 7.18 – Chat screen (Warning Message)
  • 60. 60 7.19 Download Folder  All the media and files which are received by user are stored in the Download folder (preference is SD Card).  In case of Samsung mobile phones, it is stored in phone memory.   Fig 7.19 – Downloads Folder
  • 61. 61
  • 63. 63 8.1 Problems with Wi-Fi Direct: The problems we have observed while developing the application are that  Wi-Fi Direct is still an emerging technology.  How many devices can connect?  A Wi-Fi Direct-certified network can be one-to-one, or one to-many. The number of devices in a Wi-Fi Direct-certified group network is expected to be smaller than the number supported by traditional standalone access points intended for consumer use. Connection to multiple other devices is an optional feature that will not be supported in all Wi-Fi Direct-certified devices; some devices will only make 1:1 connections.  Connection to multiple other devices is an optional feature that will not be supported in all Wi-Fi Direct-certified devices; some devices will only make 1:1 connections.  Wi-Fi Direct-certified devices will be identifiable as Wi-Fi Direct-certified devices to infrastructure access points. APs can prevent devices currently using Wi-Fi Direct from connecting to the AP, or disconnect them if already connected, while Wi-Fi Direct is in use and/or configure their parameters including channel.  Several Wi-Fi Alliance members that make devices of limited processing capabilities contributed to the specification development process to ensure that it is applicable to such devices.  Bluetooth and Wi-Fi Interference Cases . A Wi-Fi receiver senses a Bluetooth signal at the same time a Wi-Fi signal is being sent to it. The effect is most pronounced when the Bluetooth signal is within the 22-MHzwide pass band of the Wi-Fi receiver.  A Bluetooth receiver senses a Wi-Fi signal at the same time a Bluetooth signal is being sent to it; the effect is most pronounced when the Wi-Fi signal is within the pass band of the Bluetooth receiver These problems have caused a major hindrance in the development of the application. 8.2 Conclusion  This document has discussed techniques used, why they were used and the detailed working of the application.  The main work is done on the interface which is very simple and is user friendly.  This application can be used in any school/university as it does not have any
  • 64. 64 restriction. All the possible test cases have been tested for the bug free working of the application.  This needs no central server /database and only Wi-Fi enabled devices are required.  Wi-Fi direct is made for temporarily connecting a few devices in an easy-to-use and secure way, but it does not work well for larger network topologies.  The major problem a user confronts when using the Wi-Fi direct is that the device are not compatible with each other. The device crashes or gets stuck if we try to exchange multimedia.  The solution to overcome this problem is to develop the link layer and see that the connection is still on when the exchange is going on. This Application would work in a better way if there is device compatibility and Wi-Fi direct is extended to all the smart devices.  Finally, if Wi-Fi Direct becomes a widespread technology as expected, it faces the challenge of improving coexistence. 8.3 Future Scope There are various scopes for this application in future. Some of them can be as follows:  This application can be further expanded to connect to multiple clients and be used to transfer files to multiple clients at once.  An alternative application can be used to create live streaming of videos within the range of Wi-Fi.  An alternative application can be used to create live voice calling feature within the range of Wi-Fi. .  Further improvements can be made regarding continuous file transfer speed of Wi-Fi Direct.  Different types of smilies like in WhatsApp ,Facebook can be included in it.  There are several other factors that could give Wi-Fi Direct a much-needed boost in the near future. o The number of connected devices as a whole is on the rise, as manufacturers seek to add IP connectivity to everything from cameras to tablets and TVs. The Wi-Fi Alliance also threw its lot in with the Digital Living Network Alliance (DLNA) last November, ensuring that DLNA certified devices now also support Wi-Fi Direct. o Wi-Fi Direct devices are still on the way. In-Stat predicts that every connected device with Wi-Fi will ship with Wi-Fi Direct by 2014. Given that Wi-Fi Direct devices are also backwards-compatible with other Wi-Fi products that means a huge number of consumer electronics will be capable of connecting over local wireless networks without the Internet. Only one device in each wireless pairing has to be Wi-Fi Direct-enabled.
  • 65. 65 8.4 References Books [1]. James Steel and Nelson To, Android Developers Cookbook, Pearson Education, 2011. [2]. Donn Felker with Joshua Dobbs, Android Application Development For Dummies, Wiley Publishing, Inc. [3]. Lucas Jordan and Pieter Greyling, Practical Android Projects, Apress Publication. [4]. Marko Gargenta, Learning Android, O’REILLY Publication. [5]. Reto Meier, Professional Android Application Development, Wiley Publishing Inc. [6]. Frank Ableson, Charlie Collins and Robi Sen, Unlocking Android, Manning Publication Co. World Wide Web [7]. Android Developers, http://developer.android.com/develop/index.html, 4th October, 2013. [8]. How to switch between intents, http://www.androidhive.info/2011/08/ 23rd November, 2013. [9]. Android related questions, http://www.stackoverflow.com [10]. Eclipse, Android and Java training and support, http://www.vogella.com/. [11]. Beginning Java forum, http://www.coderanch.com/ [12]. http://www.wi-fi.org/files/faq_20101021_Wi-Fi_Direct_FAQ.pdf [13]. http://anrg.usc.edu/ee579_2012/Group09/#wifidirect [14] http://developer.android.com/guide/topics/connectivity/wifip2p.html