SlideShare a Scribd company logo
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 1
Chapter - 1
Introduction
1.1 Introduction to SensActions
It is an Android application which uses various sensors present on the device to
perform different functions. It includes Proximity sensor, Accelerometer sensor,
Microphone, Camera and Camera flashlight. SensAction is a combination of different
small actions by which user can interacts with their smartphone in a convenient and
smarter way. There are different gestures from which user can select to perform
different actions.
Fig1.1:SensActions Logo
SensActions is built to perform various actions without using the key in a quicker
and smarter way. It uses different sensors present on the device to perform different
actions. SensActions can make any device able to respond your shakes and
swipes/waves like any other flagship device. Even some time for fun also.
Its functions include: swiping over the proximity sensor to lock/unlock the device
or to answer/end a call, using camera’s flash light as a torch or to send SOS signals
using Morse codes. It also include the functionality to change the currently playing
song and to silent the incoming call by shaking the device which is done with the help
of accelerometer of the mobile.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 2
1.2 Purpose of Project
Caution
SensActions performs various tasks in the background. So, for best results exclude
it from task killer (if any). If after sometime SensActions does not perform desired
actions then, tap on its icon and start your action(s) again.
Help
You can view this help anytime to sort out general issues and to understand the
functioning of SensActions. To view help from main screen, Tap on Menu button or
icon -> Help.
Uninstall
To unsinstall SensActions first you have to remove it from Device Administrator
(if activated). After that you can perform normal uninstall. You can also do this from
SensActions Menu, Tap on SensActions icon -> Menu button or icon -> Uninstall.
Widgets
SensActions also supports seven type of Widgets. To add those widgets, Long
press on home screen -> Widgets ->Then select from SensLock, SensMusic or
SensCall widgets.
1.3 Project Objectives
1. SensLock:-
It is a part of SensActions which locks/unlocks the device by using proximity
sensor. When users put their phone in cover or pocket it automatically locks the
device and unlock it when the user removes it from pocket or cover.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 3
2. SensTorch:-
By this we can use our Camera flashlight as a torch. Strobe or SOS feature is also
available in to use it in emergency situations.
3. SensMusic:-
It changes the music tracks according to the direction of shake (Right shake - Play
Next and Left Shake - Play previous). It uses the accelerometer sensor to detect shake
actions. We can also select the shake threshold which defines how harder we have to
shake.
4. SensCall:-
It uses the proximity sensor to answer or end calls. Call will be automatically
answered when user puts his phone closer to ear and disconnected when away from
the ear. There are different gestures available like wave once/twice etc.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 4
Chapter - 2
System Analysis
The term “Android” has its origin in the Greek word andr-, meaning “man or
male” and the suffix -aides, used to mean “alike or of the species”. This together
means as much as “being human”.
Android is a software stack for mobile devices which means a reference to a set
of system programs or a set of application programs that form a complete system.
This software platform provides a foundation for applications just like a real working
platform.Android is a software stack for mobile devices that includes an operating
system, middleware and key applications.
Android is a software platform and operating system for mobile devices based on
the Linux operating system and developed by Google and the Open Handset Alliance.
It allows developers to write managed code in a Java-like language that utilizes
Google-developed Java libraries, but does not support programs developed in native
code.
The unveiling of the Android platform on 5 November 2007 was announced with
the founding of the Open Handset Alliance, a consortium of 34 hardware, software
and telecom companies devoted to advancing open standards for mobile devices.
When released in 2008, most of the Android platform will be made available under
the Apache free-software and open-source license.
2.1 Existing System
In July 2005, Google acquired Android Inc., a small startup company based in
Palo Alto, CA. Android's co-founders who went to work at Google included Andy
Rubin (co-founder of Danger), Rich Miner (co-founder of Wildfire Communications,
Inc), Nick Sears (once VP at T-Mobile), and Chris White (one of the first engineers at
WebTV). At the time, little was known about the functions of Android Inc. other than
they made software for mobile phones.
At Google, the team, led by Rubin, developed a Linux-based mobile device OS
which they marketed to handset makers and carriers on the premise of providing a
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 5
flexible, upgradeable system.It was reported that Google had already lined up a series
of hardware component and software partners and signaled to carriers that it was open
to various degrees of cooperation on their part.
2.2 Proposed System
On 5 November 2007, the Open Handset Alliance, a consortium of several
companies which include Google, HTC, Intel, Motorola, Qualcomm, T-Mobile,
Sprint Nextel and NVIDIA, was unveiled with the goal to develop open standards for
mobile devices. Along with the formation of the Open Handset Alliance, the OHA
also unveiled their first product, Android, an open source mobile device platform
based on the Linux operating system.
2.3. Feasibility Study
Google has unveiled at least three prototypes for Android, at the Mobile World
Congress on February 12, 2008. A prototype at the Google IO conference on May 28,
2008 had a 528 MHz Qualcomm processor and a Synaptic capacitive touch screen,
and used the UMTS cellular standard. It had 128 MB of RAM and 256 MB of flash,
showing that Android's memory requirements are reasonable.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 6
Chapter - 3
Literature Survey
3.1 Application Framework
It is used to write applications for Android. Unlike other embedded mobile
environments, Android applications are all equal, for instance, an applications which
come with the phone are no different than those that any developer writes.The
framework is supported by numerous open source libraries such as openssl, SQLite
and libc. It is also supported by the Android core libraries. From the point of security,
the framework is based on UNIX file system permissions that assure applications
have only those abilities that mobile phone owner gave them at install time.
3.2 Dalvik Virtual Machine
It is extremely low-memory based virtual machine, which was designed especially
for Android to run on embedded systems and work well in low power situations. It is
also tuned to the CPU attributes. The Dalvik VM creates a special file format (.DEX)
that is created through build time post processing. Conversion between Java classes
and .DEX format is done by included “dx” tool.
3.3 Integrated Browser
Google made a right choice on choosing WebKit as open source web browser.
They added a two pass layout and frame flattening. Two pass layout loads a page
without waiting for blocking elements, such as external CSS or external JavaScript
and after a while renders again with all resources downloaded to the device. Frame
flattening converts founded frames into single one and loads into the browser. These
features increase speed and usability browsing the internet via mobile phone.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 7
3.4 Optimized Graphics
As Android has 2D graphics library and 3D graphics based on OpenGL ES 1.0,
possibly we will see great applications like Google Earth and spectacular games like
Second Life, which come on Linux version. At this moment, the shooting legendary
3D game Doom was presented using Android on the mobile phone.
3.5 SQLite
Extremely small (~500kb) relational database management system, which is
integrated in Android. It is based on function calls and single file, where all
definitions, tables and data are stored.
This simple design is more than suitable for a platform such as Android.
3.6 Handset Layouts
The platform is adaptable to both larger, VGA, 2D graphics library, 3D graphics
library based on OpenGL ES 1.0 specifications, traditional smart phone layouts. An
underlying 2D graphics engine is also included. Surface Manager manages access to
the display subsystem and seamlessly composites 2D and 3D graphic layers from
multiple applications
3.7 Data Storage
SQLite is used for structured data storage .SQLite is a powerful and lightweight
relational database engine available to all applications.
3.8 Connectivity
Android supports a wide variety of connectivity technologies including GSM,
CDMA, Bluetooth, EDGE, EVDO, 3G and Wi-Fi.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 8
3.9 Messaging
SMS, MMS, and XMPP are available forms of messaging including threaded text
messaging.
3.10 Web Browser
The web browser available in Android is based on the open-source WebKit
application framework. It includes LibWebCore which is a modern web browser
engine which powers both the Android browser and an embeddable web view.
3.11 Java Virtual Machine
Software written in Java can be compiled into Dalvik bytecodes and executed in
the Dalvik virtual machine, which is a specialized VM implementation designed for
mobile device use, although not technically a standard Java Virtual Machine.
3.12 Media Support
Android will support advanced audio/video/still media formats such as MPEG-4,
H.264, MP3, and AAC, AMR, JPEG, PNG, GIF.
3.13 Additional Hardware Support
Android is fully capable of utilizing video/still cameras, touchscreens, GPS,
compasses, accelerometers, and accelerated 3D graphics.
3.14 Development Environment
Includes a device emulator, tools for debugging, memory and performance
profiling, a plugin for the Eclipse IDE. There are a number of hardware dependent
features, for instance, a huge media and connections support for GPS.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 9
Chapter - 4
Research, Hypothesis, Design, Methodology
Android is hailed as “the first complete, open, and free mobile platform”.
a) Complete: The designers took a comprehensive approach when they
developed the Androidplatform.They began with a secure operating
system and built a robust software framework on top that allows for rich
application development opportunities.
b) Open: The Android platform is provided through open source licensing.
Developers have unprecedented access to the handset features when
developing applications.
c) Free: Android applications are free to develop.There are no licensing or
royalty fees to develop on the platform. No required membership fees. No
required testing fees.No required signing or certification fees.Android
applications can be distributed and commercialized in a variety of ways.
4.1 Runtime
Android includes a set of core libraries that provides most of the functionality
available in the core libraries of the Java programming language.Every Android
application runs in its own process, with its own instance of the Dalvik virtual
machine. Dalvik has been written so that a device can run multiple VMs efficiently.
The Dalvik VM executes files in the Dalvik Executable (.dex) format which is
optimized for minimal memory footprint. The VM is register-based, and runs classes
compiled by a Java language compiler that have been transformed into the .dex format
by the included "dx" tool.The Dalvik VM relies on the Linux kernel for underlying
functionality such as threading and low-level memory management.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 10
4.2 Linux Kernel
Android relies on Linux version 2.6 for core system services such as security,
memory management, process management, network stack, and driver model. The
kernel also acts as an abstraction layer between the hardware and the rest of the
software stack.
It helps to manage security, memory management, process management, network
stack and other important issues. Therefore, the user should bring Linux in his mobile
device as the main operating system and install all the drivers required in order to run
it.
Developers have full access to the same framework APIs used by the core
applications. The application architecture is designed to simplify the reuse of
components; any application can publish its capabilities and any other application
may then make use of those capabilities (subject to security constraints enforced by
the framework). This same mechanism allows components to be replaced by the
user.Underlying all applications is a set of services and systems.
4.3 Architecture
The following diagram shows the major components of the Android operating
system. Each section is described in more detail below.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 11
Fig 4.1: Architecture of Android
Android Architecture is based on Linux 2.6 kernel. It helps to manage security,
memory management, process management, network stack and other important
issues. Therefore, the user should bring Linux in his mobile device as the main
operating system and install all the drivers required in order to run it. Android
provides the support for the Qualcomm MSM7K chipset family. For instance, the
current kernel tree supports Qualcomm MSM 7200A chipsets, but in the second half
of 2008 we should see mobile devices with stable version Qualcomm MSM 7200,
which includes major features:
a) WCDMA/HSUPA and EGPRS network support
b) Bluetooth 1.2 and Wi-Fi support
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 12
c) Digital audio support for mp3 and other formats
d) Support for Linux and other third-party operating systems
e) Java hardware acceleration and support for Java applications
f) Camera up to 6.0 megapixels
g) And lots of other.
4.4 Libraries
In the next level there are a set of native libraries written in C/C++, which are
responsible for stable performance of various components. For example, Surface
Manager is responsible for composing different drawing surfaces on the mobile
screen. It manages the access for different processes to compose 2D and 3D graphic
layers.OpenGL ES and SGL make a core of graphic libraries and are used accordingly
for 3D and 2D hardware acceleration. Moreover, it is possible to use 2D and 3D
graphics in the same application in Android. The media framework was provided by
PacketVideo, one of the members of OHA. It gives libraries for a playback and
recording support for all the major media and static image files. FreeType libraries are
used to render all the bitmap and vector fonts. For data storage, Android uses SQLite.
As mentioned before, it is extra light rational management system, which locates a
single file for all operations related to database. WebKit, the same browser used by
Apple Safari, was modified by Android in order to fit better in a small size screens.
4.5 Android Runtime
At the same level there is Android Runtime, where the main component Dalvik
Virtual Machine is located. It was designed specifically for Android running in
limited environment, where the limited battery, CPU, memory and data storage are
the main issues. Android gives an integrated tool dx, which converts generated byte
code from .jar to .dex file, after this byte code becomes much more efficient to run on
the small processors.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 13
Fig 4.2: Conversion from .java to .dex file
As the result, it is possible to have multiple instances of Dalvik virtual machine
running on the single device at the same time. The Core libraries are written in Java
language and contains of the collection classes, the utilities, IO and other tools.
4.6 Application Layer
After that, there is Application Framework, written in Java language. It is a toolkit
that all applications use, ones which come with mobile device like Contacts or SMS
box, or applications written by Google and any Android developer. It has several
components.
The Activity Manager manages the life circle of the applications and provides a
common navigation back stack for applications, which are running in different
processes. The Package Manager keeps track of the applications, which are installed
in the device. The Windows Manager is Java programming language abstraction on
the top of lower level services that are provided by the Surface Manager.
The Telephony Manager contains of a set of API necessary for calling
applications. Content Providers was built for Android to share a data with other
applications, for instance, the contacts of people in the address book can be used in
other applications too. The Resource Manager is used to store localized strings,
bitmaps, layout file descriptions and other external parts of the application. The View
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 14
System generates a set of buttons and lists used in UI. Other components like
Notification manager is used to customize display alerts and other functions.
At the top of Android Architecture we have all the applications, which are used by
the final user. By installing different applications, the user can turn his mobile phone
into the unique, optimized and smart mobile phone. All applications are written using
the Java programming language.
4.6.1 Application Building Blocks
We can think of an Android application as a collection of components, of various
kinds. These components are for the most part quite loosely coupled, to the degree
where you can accurately describe them as a federation of components rather than a
single cohesive application.
Generally, these components all run in the same system process. It's possible (and
quite common) to create multiple threads within that process, and it's also possible to
create completely separate child processes if you need to. Such cases are pretty
uncommon though, because Android tries very hard to make processes transparent to
your code.
Google provides three versions of SDK for Windows, for Mac OSX and one for
Linux.The developer can use Android plugin for Eclipse IDE or other IDEs such as
intelliJ.First step for Android developer is to decompose the prospective application
into the components, which are supported by the platform.
The major building blocks are:
a) Activity
b) Intent Receiver
c) Service
d) Content Provider
Activity:User interface component, which corresponds to one screen at time. It
means that for the simple application like Address Book, the developer should have
one activity for displaying contacts, another activity component for displaying more
detailed information of chosen name and etc.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 15
Intent Receiver:Wakes up a predefined action through the external event. For
example,for the application like Email Inbox, the developer should have intent
receiver and register his code through XML to wake up an alarm notification, when
the user receives email.
Service:A task, which is done in the background. It means that the user can start
an application from the activity window and keep the service work, while browsing
other applications. For instance, he can browse Google Maps application while
holding a call or listening music while browsing other applications.
Content Provider:A component, which allows sharing some of the data with
other processes and applications. It is the best way to communicate the applications
between each other.Android will ship with a set of core applications including an
email client, SMS program, calendar, maps, browser, contacts, and others. All
applications are written using the Java programming language.
4.6.2 AndroidManifest.xml
The AndroidManifest.xml file is the control file that tells the system what to do
with all the top-level components (specifically activities, services, intent receivers,
and content providers described below) you've created. For instance, this is the "glue"
that actually specifies which Intents your Activities receive.
A developer should predefine and list all components, which he wants to use in
the specific AndroidManifest.xml file. It is a required file for all the applications and
is located in the root folder. It is possible to specify all global values for the package,
all the components and its classes used, intent filters, which describe where and when
the certain activity should start, permissions and instrumentation like security control
and testing.
Here is an example of AndroidManifest.xml file:
1. <xml version="1.0" encoding="utf-8">
2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3. package="com.pranav.android.hello">
4. <application android:icon="@drawable/icon">
5. <activity class=".HelloAndroid" android:label="@string/app_name">
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 16
6. <intent-filter>
7. <action android:value="android.intent.action.MAIN" />
8. <category android:value="android.intent.category.LAUNCHER"/>
9. </intent-filter>
10. </activity>
11. </application>
12. </manifest>
The line 2 is a namespace declaration, which makes a standard Android attributes
available for that application.
In the line 4 there is a single <application> element, where the developer specifies
all application level components and its properties used by the package.
Activity class in the line 5 represents the initial screen the user sees and it may
have one or more <intent-filter> elements to describe the actions that activity
supports.
4.6.3 Application Lifecycle
In Android, every application runs in its own process, which gives better
performance in security, protected memory and other benefits. Therefore, Android is
responsible to run and shut down correctly these processes when it is needed.
It is important that application developers understand how different application
components (in particular Activity, Service, and BroadcastReceiver) impact the
lifetime of the application's process. Not using these components correctly can result
in the system killing the application's process while it is doing important work.
To determine which processes should be killed when low on memory, Android
places each process into an "importance hierarchy" based on the components running
in them and the state of those components. These process types are (in order of
importance).
There will only ever be a few such processes in the system, and these will only be
killed as a last resort if memory is so low that not even these processes can continue
to run. Generally, at this point, the device has reached a memory paging state, so this
action is required in order to keep the user interface responsive
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 17
a) A foreground process is one that is required for what the user is currently doing.
Variousapplication components can cause its containing process to be considered
foreground in different ways. A process is considered to be in the foreground if any
of the following conditions hold:
(i) It is running an Activity at the top of the screen that the user is interacting
with(its onResume() method has been called).
(ii) It has a BroadcastReceiver that is currently running (its
BroadcastReceiver.onReceive() method is executing).
(iii) It has a Service that is currently executing code in one of its callbacks
(Service.onCreate(), Service.onStart(), or Service.onDestroy()).
b) A visible process is one holding an Activity that is visible to the user on-screen
but not in theforeground (its onPause() method has been called). This may occur,
for example, if the foreground Activity is displayed as a dialog that allows the
previous Activity to be seen behind it. Such a process is considered extremely
important and will not be killed unlessdoing so is required to keep all the
foreground processesrunning.
c) A service process is one holding a Service that has been started with the
startService() method. Though these processes are not directly visible to the user,
they are generally doing things that the user cares about (such as background mp3
playback or background network data upload or download), so the system will
always keep such processes running unless there is not enough memory to retain
all foreground and visible process.
d) A background process is one holding an Activity that is not currently visible to the
user (its onStop() method has been called). These processes have no direct impact
on the user experience. Provided they implement their Activity life-cycle correctly
(see Activity for more details), the system can kill such processes at any time to
reclaim memory for one of the three previous processes types. Usually there are
many of these processes running, so they are kept in an LRU list to ensure the
process that was most recently seen by the user is the last to be killed when
running low on memory.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 18
e) An empty process is one that doesn't hold any active application components. The
only reason to keep such a process around is as a cache to improve startup time the
next time a component of its application needs to run. As such, the system will
often kill these processes in order to balance overall system resources between
these empty cached processes and the underlying kernel caches.
Fig 4.3: Flowchart Showing the Lifecycle of an Activity
4.6.4 Application Framework
Developers have full access to the same framework APIs used by the core
applications. The application architecture is designed to simplify the reuse of
components; any application can publish its capabilities and any other application
may then make use of those capabilities (subject to security constraints enforced by
the framework). This same mechanism allows components to be replaced by the user.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 19
Underlying all applications is a set of services and systems, including:
a) A rich and extensible set of Views that can be used to build an application,
including lists, grids, text boxes, buttons, and even an embeddable web browser .
b) Content Providers that enable applications to access data from other applications
(such as Contacts), or to share their own data.
c) A Resource Manager, providing access to non-code resources such as localized
strings, graphics, and layout files.
d) A Notification Manager that enables all applications to display custom alerts in the
status bar.
e) An Activity Manager that manages the life cycle of applications and provides a
common navigation back stack.
4.6.5 Library
Android includes a set of C/C++ libraries used by various components of the
Android system. These capabilities are exposed to developers through the Android
application framework. Some of the core libraries are listed below:
a) System C library: a BSD-derived implementation of the standard C system library
(libc), tuned for embedded Linux-based devices.
b) Media Libraries: based on PacketVideo's OpenCORE; the libraries support
playback and recording of many popular audio and video formats, as well as static
image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
c) Surface Manager: manages access to the display subsystem and seamlessly
composites 2D and 3D graphic layers from multiple applications.
d) LibWebCore: a modern web browser engine which powers both the Android
browser and an embeddable web view.
e) 3D libraries: an implementation based on OpenGL ES 1.0 APIs; the libraries use
either hardware 3D acceleration (where available) or the included, highly
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 20
optimized 3D software rasterizer.
f) FreeType - bitmap and vector font rendering.
g) SQLite - a powerful and lightweight relational database engine available to all
applications.
4.7 Security Issues
Android mobile phone platform is going to be more secure than Apple’s iPhone or
any other device in the long run. There are several solutions nowadays to protect
Google phone from various attacks. One of them is security vendor McAfee, a
member of Linux Mobile (LiMo) Foundation. This foundation joins particular
companies to develop an open mobile-device software platform.
Many of the companies listed in the LiMo Foundation have also become
members of the Open Handset Alliance (OHA).
However, open platform has its own disadvantages, such as source code
vulnerability for black-hat hackers. In parallel with great opportunities for mobile
application developers, there is an expectation for exploitation and harm. Stealthy
Trojans hidden in animated images, particular viruses passed from friend to friend,
used for spying and identity theft, all these threats will be active for a long run.
Another solution for such attacks is SMobile Systems mobile package.
SecurityShield integrated application that includes anti-virus, anti-spam, firewall and
other mobile protection is up and ready to run on the Android operating system.
Currently, the main problem is availability for viruses to pose as an application and do
things like dial phone numbers, send text messages or multi-media messages or make
connections to the Internet during normal device use.
Hence SMobile Systems is ready to notify and block these secure alerts. But the
truth is that it is not possible to secure your mobile device or personal computer
completely, as it connects to the internet.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 21
Chapter - 5
Comparison
5.1 Speculations with Cellular Carriers
Google Android enters a tangled mess of cellular carrier world. As a new player in
the mobile market, Android brings an open platform with the new rules. On the one
hand there is OHA with major companies and carries, such as T-Mobile and Sprint.
On the other hand, there are two largest cellular carries AT&T and Verizon Wireless
in United States, which have a vested interest in operating systems of their own.
It is predictable, that Sprint or T-Mobile will be first carriers providing devices
with Google Android. This ensures equal development time for the networks, GSM
side and CDMA.But the main problem, which faces all the cellular carriers around the
world, is the availability to download and use free applications that could block
almost every communications product they sell. A user does not need to pay for GPS
mapping service anymore. He can simply download a free one that taps into Google
Maps.
In fact,why pay for cellular minutes at all when a user can download Skype, Gtalk
or other client and just use his data plan OS such as Android threaten carriers with a
loss of control over the applications on the phones on their network and they may find
themselves becoming nothing more than wireless Internet service providers, forced to
compete on price and bandwidth.
Another aspect is hardware cost: Google Android owns 10 percent of the total cost
of a phone, which combined with falling hardware prices could eventually result a
fertile unlocked handset market. In conclusion, Google has a better start in this race
than any company had before to bring new rules to the mobile market with all
carriers, mobile devices and its customers.
5.2 Manufacturers War
Presently, Google main competitors like Nokia, Microsoft and Apple do not see
Google Android as a serious rival or threat to their business strategies. However, the
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 22
current situation is not so unsophisticated. There is a huge flurry in the companies,
which are not in the list of OHA.
For instance, Nokia, which is the largest handset manufacturer in the world,
nowadays owning some 39% market share, was one of the companies snubbed on the
invitation list to the 34-party Open Handset Alliance that is growing daily.
In contrast, Nokia is buying companies and dumping cash into development,
while Google is releasing an open platform hoping the applications and services will
build themselves with the help of a strong developer community, development
contests and large alliance of grand companies.
Despite of this, Nokia is ready to combat whatever Google has to throw with
Google Android in 2008. Another company Apple has already stroked the market
with iPhone and its closed operating system. Accordingly, iPhone in the US remains
loyal to AT&T mobile carrier for five years.
That is plenty of time for Google to conquer the market with open
Android.Obvious advantage of Android is cost: while iPhone is priced at a weighty
$400, Google says it hopes to reach a more mainstream market by pricing Android-
powered devices at around $200. Microsoft, selling 21 million copies of Windows
Mobile software, stays calm at this point, waiting for some particular results from
Google Android.
This nice and healthy competition is just what the mobile industry needs at the
moment,at least for the consumers. The wars being waged between Google and the
field will onlycreate better, cheaper handsets and more advanced applications.
5.3 Market Research
A new generation of mobile device users is coming in the next decade. These
users are going to explore the mobile internet afresh with its new features, compatible
mobile phones, new services and applications.
This is a huge leap for mobile advertisement business, where revenue could rise 8
times more by 2012. Google Android is going to present new solutions through the
fast search engine, open source applications and other services.
The Kelsey Group, which works with public opinion polls and statistics, published
the results released October 11 2007, which say, that one hundred out of 500, or 20
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 23
percent of people would be interested in purchasing a Google phone. Despite the fact,
that Google Android is in alpha version and it is unknown for the customers and
mobile market, the results look promising.
People do not find a good Internet experience in their phones today, so they
are more interested in gravitating toward an Internet or technology company
telephone because they think connectivity between devices and to the Internet is going
to be much better on those phones. They use Google search, GMail, Google Maps,
Picasa albums and other popular services on their computers, and this is what they
expect to have in their mobile devices in the close future.
5.4 Mobile Ads
Jaiku - an activity stream and sharing service that works from the Web and mobile
phones was bought by Google as important investment into the mobile
advertisement.People wondered why Google preferred the micro-blogging service to
Twitter, which is much more popular nowadays.
The answer lies in Jaiku unique ability to combine micro-blogging with users
location. An integral part of the service is a Jaiku client application for Symbian S60
platform mobile phones, which should come to Android platform as well. The client
uses location APIs within device to get the handset and the user’s location based on
nearby cellular network towers.
Though the location is not very precise, the mobile phone is able to broadcast it
automatically. At that point the text can be connected to users location and create a
list of preferences for each place the user frequently visits.
Using such a technology, it is simple to track down a user via phone IP address,
whenever he comes into McDonald or is sitting in the airport.Google is not a million
miles away from being able to push advanced advertising to individuals based on their
profile, their location and their availability. They already offer regional and local
targeting for ads for desktop users, but this could be much more useful for a mobile
phone. And if the ads are truly relevant, interesting and unobtrusive, people might
actually start to like them.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 24
5.5 Mobile Services
Adding to its fast growing suite of mobile applications and services, Google has
applied for a patent for a mobile payments service that would allow users to make
payments at retail shops using their mobile phones. The Text Message Payment patent
describes a system where Google offers mobile focused payments called GPay. This
describes a system where a SMS message would be sent containing a payment
amount and other information. That payment amount would then be validated, debited
from the user's account, and communicated from server to server.
Described as "a computer-implemented method of effectuating an electronic on-
line payment," the system mentioned in the patent application is similar to existing
mobile payment services.
These services like mobile version of PayPal have been available for some time
but have had little success bursting with merchants and with customers. The main
difference between existing mobile payment systems and GPay is, of course, that
GPay is created by Google and will be easily adopted by Android Platform. The more
issues regarding Gpay are yet to be released.
5.6 What Makes Android Special
There are already many mobile platforms on the market today, including
Symbian, iPhone, Windows Mobile, BlackBerry, Java Mobile Edition, Linux Mobile
(LiMo), and more.
While some of its features have appeared before, Android is the best environment
that combines:
a) A truly open, free development platform based on Linux and open source. Handset
makers like it because they can use and customize the platform without paying a
royalty. Developers like it because they know that the platform has legs and is not
locked into any one vendor that may go under or be acquired.
b) A component-based architecture inspired by Internet mash-ups. Partsof one
application can be used in another in ways not originallyenvisioned by the
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 25
developer. You can even replace built-in components with your own improved
versions. This will unleash a new round of creativity in the mobile space.
c) Tons of built-in services out of the box. Location based services use GPS or cell
tower triangulation to let you customize the user experience depending on where
they are. A full-powered SQL database lets you harness the power of local storage
for occasionally connected computing and synchronization. Browser and Map
views can be embedded directly in your applications. All these built-in capabilities
help to raise the bar on functionality while loweringyour development costs.
d) Automatic management of the application life cycle. Programs are isolated from
each other by multiple layers of security, which will provide a level of system
stability not seen before in smart phones.The end user will no longer have to worry
about what applications are active, or close some programs so that others can run.
Android is optimized for low-power, low-memory devices in a fundamental way
that no previous platform has attempted.
e) High quality graphics and sound. Smooth, anti-aliased 2D vector graphics and
animation inspired by Flash is melded with 3D accelerated OpenGL graphics to
enable new kinds of games and business applications. Codec for the most common
industry standard audio and video formats are built right in, including H.264
(AVC), MP3, and AAC.
f) Portability across a wide range of current and future hardware.All your programs
are written in Java and executed by Android’s Dalvik virtual machine so your code
will be portable across ARM,x86, and other architectures. Support for a variety of
input methods is included such as keyboard, touch, tilt, camera, voice, and
trackball. User interfaces can be customized for any screen resolution and
orientation.Android is a fresh take on the way mobile applications interact with
users, along with the technical underpinnings to make it possible. But the best part
of Android is the software that you are going to write for it. This book will help
you get off to a great start.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 26
5.7 Android and Java ME
Java Platform, Micro Edition or Java ME (previously known as Java 2 Platform,
Micro Edition or J2ME) is a specification of a subset of the Java platform aimed at
providing a certified collection of Java APIs for the development of software for
small, resource-constrained devices. Though, do not confuse it with Google Android,
even there are some similarities:
a) Eclipse plug-ins for J2ME and Android look very similar and interface very
well with their respective SDKs;
b) Both J2ME and Android seem to share the same core Java APIs, such as
java.util and java.net. But their APIs for graphics, UIs, etc. are very dissimilar
and philosophies for developing applications are very different;
c) Android seems to be more tightly integrated (up to even the OS services
provided and how they interact with the APIs), while J2ME is far more liberal
in its specifications for the developer and mobile device manufacturer.
A slower application development and performance, these are the main
disadvantages Java's J2ME have for today. J2ME apps are second-rate citizens in the
phones. They do not have an access to most of the low-level features, like call API,
external connectivity (USB) and other. There is no way to replace or extend built-in
phone apps like contacts, calendar and calls.
5.8 Openness of the Platform
The open source school of thought implies that differentiation and competitive
advantage come from innovation on top of the underlying platform rather than the
platform itself. The robustness and scalability of the platform is secured by the
community’s stewardship, and open access to a central repository of updated code.
Beyond this, a strong third-party development environment and software development
kit (SDK) are critical to attracting innovation.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 27
Open is an invariably subjective term. Symbian and Microsoft can claim a degree
of openness for their mobile platforms, for example, but ultimate control of API
access and source code remains with a single entity. On the contrary, as Google has
pointed out, there’s nothing keeping any of the alliance members from using Android
to build a Yahoo! Go phone.
Importantly, Android includes almost the entirety of the applications-related
software stack, less key technical pieces such as telephony protocol stacks, which are
left to silicon vendors. Android bundles critical components such as a Linux kernel
from Wind River, various optimized graphics engines, codecs, notification software, a
clean room JVM implementation, and the KHTML open source browser. The latter
forms the basis of Apple’s Safari and Nokia’s S60 offerings.
5.9 Advantages
a) Open - Android allows you to access core mobile device functionality through
standard API calls.
b) All Applications are Equal - Android does not differentiate between the phone's
basic and third-party applications -- even the dialer or home screen can be
replaced.
c) Breaking Down Boundaries - Combine information from the web with data on
the phone -- such as contacts or geographic location -- to create new user
experiences.
d) Fast And Easy Development - The SDK contains what you need to build and run
Android applications, including a true device emulator and advanced debugging
tools.
5.10 Disadvantages
a) Security - Making source code available to everyone inevitably invites the
attention of black hat hackers.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 28
b) Open Source - A disadvantage of open-source development is that anyone can
scrutinize the source code to find vulnerabilities and write exploits.
c) Login - Platform doesn't run on an encrypted file system and has a vulnerable log-
in.
d) Incompetence - Google dependence on hardware and carrier partners puts the final
product out of their control.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 29
Chapter - 6
Project Plan and Timeline
6.1 ProjectPlan
SensActions has been in development since August, 2013 and the final release of
the project was inApril, 2014 and we further plan to improve the project to improve
upon user experience and to increase the user satisfaction level with our application.
As the project is already in the public domain, i.e. it is available on the Google
Play Store, it open to user scrutiny. We encourage all the healthy criticism provided
by the users of our application which help us to bring further improvements in the
app.
As the android platform is used on a diverse number devices provided by different
vendors with different hardware specifications and as our application relies heavily on
the hardware some problems are bound to crop up. We try to solve such problems as
and when they are reported by the users of our application.
Spanning a period of 7 months the project encompasses a large number of
modules, algorithms, java classes and XML code utilizing the mobile device’s
hardware and software.
The summary of the project’s development and download stats till 15 November,
2013 is depicted through the following graph and chart:
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 30
Fig 6.1: Download Stats for SensActions
First public release on Google Play store: 12-08-2013
First download on: 13-08-2013
Download count: Approx. 1550 and still counting
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 31
6.2 Timeline
The summary of the project’s development and its timeline can be depicted
through the following diagram:
05-08-2013
Development work started
11-08-2013
SensLock module completed
12-08-2013
SensLock published on Play Store
28-08-2013
Development on other
modules started
12-09-2013
SensMusicmodule completed
26-09-2013
SensCall module completed
10-10-2013
First update to the app released
(new features)
16-10-2013
SensTorch module completed
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 32
Fig 6.2: Flowchart Showing the Lifecycle of SensActions
08-12-2013
Secondupdate to the app released
(new features & bug fixes)
21-01-2014
Solved compatibility issues with
some Android devices
07-02-2014
Updated the app’s User Interface
03-03-2013
Started work on the
Documentation
23-03-2014
Implement Morse code
functionality in SensTorch
02-04-2014
Implement SensSteps module
17-04-2014
Complete the documentation
and user manual
25-04-2014
Final Application
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 33
Chapter - 7
Software Specification and Requirements
7.1 Overview
Platform:-Android
Supported android versions:- 2.2 - 4.4.x
Number ofsupporteddevices:- 3981 models
Programming languages used:- JAVA and XML
IDE used:- Eclipse Indigo
Source code size:- Approx. 4.3mb
Final application size:- Approx. 700kb
Application extension:- .apk (Application Package)
7.2 Requirements
7.2.1 Software Requirements
Platform:- Android
Android version: - 2.2 and above
Screen Size: - All types of screen sizes are supported
RAM:- Depends upon enabled actions (3 MB to10 MB)
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 34
7.2.2 Hardware Requirements
At least one of them:-
* Proximity Sensor
* Accelerometer Sensor
* Front Camera
* Microphone (Present in all devices)
* Camera Flashlight
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 35
Chapter - 8
Organization Chart for Different Modules
SensLock SensTorch SensMusic SensCall
Fig 8.1: Componentsof SensActions
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 36
8.1 SensLock:
Start Service
Check for
ProximitySensor
Not Found
Stop
Found (Get
values)
If greater than
Maximum Range
Sensor is open or
not in cover (Lock
the device)
Else
Sensor is closed or
in cover (Unlock
the device)
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 37
8.2 SensMusic:
Start Service
Check for
Accelerometer
Sensor
Not Found
Stop
Found (Get
values in x, y, z)
Check difference
of previous and
new value
If greater than
Shake threshold
Shake detected
(Changetrack)
Else
No shake
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 38
8.3 SensCall:
Call Service
Check for
Proximity Sensor
Not Found
Stop
Found (Get
values)
If greater than
Maximum Range
Sensor is open or
not in cover (End
the call)
Else
Sensor is closed
or in cover
(Answer the call)
Shake Service
Start Service
Check for
Accelerometer
Sensor
Not Found
Stop
Found (Get
values in x, y, z)
Check difference
of previous and
new value
If greater than
Shake threshold
Shake detected
(Mute ringer)
Else
No shake
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 39
8.4SensTorch:
On Start
Check for
Camera
Flashlight
Not Found
Stop (Display
message)
Found (Check
for Strobe)
If enabled
Turn On and off
at selected
interval
Else
Turn On
continuously
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 40
Chapter - 9
Modules Present
9.1 SensLock
Activity
First you have to activate SensLock Admin to perform any function. To do this,
Tap on Activate SensLock.
Enable
Enable SensLock to perform lock/unlock actions by monitoring proximity sensor.
It automatically locks the screen when in cover or proximity and unlocks it again
when not in cover or proximity depending upon the selected gesture. To do this, Tap
on Enable SensLock.
Lock/Unlock Device
Now, you have to Enable lock or unlock to perform actions according to your
need. There are some additional settings like Quick unlock which automatically
bypass the lock screen. Disable in landscape mode to avoid accidental locks while
playing games or watching videos.
Lock/Unlock Gestures
You can select from various gestures to perform lock/unlock actions. It also has
Hold timeout for which you have to hold to trigger the action.
Gesture Timeout
In this you can select the timeout after which the gesture will be ignored and you
have to perform the gesture again. It is beneficial to avoid accidental screen unlocks
when the device is in pocket or cover.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 41
Delay lock
Lock method wakes up the screen again in Android 4.0.4 - 4.1.2. So, to avoid
screen flicker, it will delay the lock screen for some time.
Keep Screen On
These settings will apply when your device will wake up next time via proximity
sensor.
Widgets
It also support widgets. There are three types, one is to enable/disable action via
sensor, second one is to lock the screen immediately and third one is to toggle
SensLock. To add them, long press on your home screen -> Widgets -> SensLock
Toggle or SensLock LockNow or SensLock Mode.
LockNow Widgets
It will lock the device immediately. Lock method wakes up the screen again in
Android 4.0.4 - 4.1.2. So, to avoid this check Force lock again option in Settings. If
your device behaves abnormally after doing this then, uncheck this option and select
your system lock screen to none.
9.2 SensTorch
Caution
Prolonged usage of SensTorch may decrease your battery life. So, use it whenever
it is necessary and switch off immediately after the usage.
Strobe or SOS
To turn on the strobe or SOS tap on Strobe checkbox. Again tap on Strobe to turn
it off.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 42
Strobe Frequency
You can also select strobe frequency so that torch will toggle according to the
selected interval. To do this, Tap on Menu button or icon -> Settings and then, select
Strobe frequency.
9.3 SensMusic
Enable
First you have to enable SensMusic to change your tracks by shaking the device.
To enable SensMusic, Tap on Enable SensMusic. After that you can change different
settings according to your need.
Apply on Boot
Tap on this if you want to start SensMusic service automatically when device
boots up.
Show Notification
Tap on this if you want to enable notification when SensMusic is enabled. It will
also show the selected shake action.
Shake Action
In this you can select shake actions which you have to perform when shake is
performed. There are three actions:- Play Next - Skip to next track, Play previous –
Skip to previous track, Play according to shake - It will skip the track in the direction
of shake. Shake right to play next and shake left to play previous track.
Shake Threshold
In this you can select, how harder you have to shake the device. Higher the value,
harder you have to shake. Try different values to find perfect match for your device.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 43
Shake Delay
In this you can select the delay between two consecutive shakes to avoid skipping
of multiple tracks. After first shake, you have to wait for the selected delay to perform
next shake otherwise, it will be ignored.
Widgets
There are two widgets available. SensMusic Toggle to enable or disable
SensMusic service and SensMusic Action to quickly switch between Shake actions.
To use this widget first you have to enable SensMusic.
9.4 SensCall
Enable
First you have to enable SensCall to answer or end call using proximity sensor. To
enable SensCall, Tap on Enable SensCall. After that you can change different settings
according to your need.
Apply on Boot
Tap on this if you want to start SensCall service automatically when device boots
up.
Show Notification
Tap on this if you want to enable notification when SensCall is enabled. It will
also show the answer/end call mode (if enabled).
Shake to Mute
Enable this if you want to mute the incoming call ringer by shaking the device.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 44
Shake Threshold
In this you can select, how harder you have to shake the device. Higher the value,
harder you have to shake. Try different values to find perfect match for your device.
Enable Answer Call
Enable this to answer the call by using proximity sensor. After that you can
change other answer call settings.
Pocket Protection
Enable this to avoid accidental call pick up when the device is in pocket or cover.
After enabling this you have to perform the call answer gesture one more time.
Answer Call Gesture
In this you can select the different gestures to answer the call. Close to ear or in
proximity:- Just bring the device close to ear and the call will be answered,
Swipe/wave once:- Move your hand over the proximity sensor once to accept the call,
Swipe/wave twice:- Move your hand over the proximity sensor twice to accept the
call, Swipe/wave and hold:- Cover the proximity sensor and hold it for the selected
timeout.
Hold Timeout
Select time (in seconds) for which you have to cover the proximity sensor to
answer the call.
Enable End Call
Enable this to end the call by using proximity sensor. After that you can change
other end call settings.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 45
Enable Call Gesture
In this you can select the different gestures to end the call. Away from ear or not
in proximity:- Just take the device away from ear and the call will be ended, Away
and Swipe/wave once:- Take the device away from ear and then, move your hand
over the proximity sensor once to end the call, Away and Swipe/wave twice:- Take
the device away from ear and then, move your hand over the proximity sensor twice
to end the call, Away from ear and hold:- Take the device away from ear and call will
be ended after the selected timeout.
Hold Timeout
Select time (in seconds) for which you have to hold the device away from ear to
end the call.
Widgets
There are two widgets available. SensCall Toggle to enable or disable SensCall
service and SensCall Mode to quickly switch between modes:-Answer/end call,
Answer call, End call. To use this widget first you have to enable SensCall.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 46
Chapter -10
Source Code
Java and XML programming languages are extensively used while programming
an Android application. Same is the case with SensActions which uses Java and XML
to code the working logic and the user interface of the application.
 Java is the main programming language which is used to code the working
logic and the background operating functions of this application.
 XML have been used to design the beautiful and attractive user interface
which provides a consistent elegant feel to the entire application.
 Adobe Photoshop have been used to create various images and icons present
in the application.
10.1 Java Code
10.1.1 Main Menu
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
public class SensActions extends ActionBarActivity{
private Button lock, torch, music, call, help, about, unins;
private TextView en_actions, no_item;
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 47
private ImageView im_lock, im_call, im_music;
private LinearLayout firstRow, secondRow, thirdRow;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sens_actions_main);
lock = (Button) findViewById(R.id.btnSensLock);
torch = (Button) findViewById(R.id.btnSensTorch);
music = (Button) findViewById(R.id.btnSensMusic);
call = (Button) findViewById(R.id.btnSensCall);
help = (Button) findViewById(R.id.btnHelp);
about = (Button) findViewById(R.id.btnAbout);
unins = (Button) findViewById(R.id.btnUninstall);
en_actions = (TextView) findViewById(R.id.textEnActions);
lock.setOnClickListener (new OnClickListener() {
public void onClick(View v)
{
startAction(SensActions.this, SensLock.class);
}
});
lock.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showVisibleItems();
return true;
}
});
torch.setOnClickListener (new OnClickListener() {
public void onClick(View v)
{
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 48
startAction(SensActions.this, SensTorch.class);
}
});
torch.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showVisibleItems();
return true;
}
});
music.setOnClickListener (new OnClickListener() {
public void onClick(View v)
{
startAction(SensActions.this, SensMusic.class);
}
});
music.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showVisibleItems();
return true;
}
});
call.setOnClickListener (new OnClickListener() {
public void onClick(View v)
{
startAction(SensActions.this, SensCall.class);
}
});
call.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 49
showVisibleItems();
return true;
}
});
Toast.makeText(SensActions.this,
R.string.welcome_text, Toast.LENGTH_LONG).show();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.disclaimer)
.setMessage(R.string.disclaimer_content)
.setCancelable(false)
.setPositiveButton(R.string.ok, new
DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SensLock.stopService(SensActions.this,
SensLockService.class);
SensLock.stopService(SensActions.this,
SensMusicService.class);
dialog.dismiss();
Intent help = new Intent(getBaseContext(),
SensActionsHelp.class);
startActivity(help);
Toast.makeText(SensActions.this,
R.string.welcome_help_text,
Toast.LENGTH_LONG).show();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 50
10.1.2 SensLock
import android.app.admin.DeviceAdminReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.widget.Toast;
public class SensLockAdmin extends DeviceAdminReceiver{
static SharedPreferences getSamplePreferences(Context context) {
return context.getSharedPreferences(
DeviceAdminReceiver.class.getName(), 0);
}
@Override
public void onEnabled(Context context, Intent intent) {
Toast.makeText(context,
R.string.admin_activate, Toast.LENGTH_SHORT).show();
if(SensLock.loadPrefs(context, "prefEnableSensLock", false))
{
SensLock.startService(context, SensLockService.class);
}
if(SensLock.loadPrefs(context, "prefShowNotify", false))
{
SensLock.startService(context, NotificationService.class);
}
SensLock.startService(context, UpdateWidgetService.class);
if(SensLock.loadPrefs(context, "IsFirstLock", true))
{
SensLock.savePrefs(context, "IsFirstLock", false);
Toast.makeText(context,
R.string.welcome_enable_text, Toast.LENGTH_LONG).show();
}
}
@Override
public void onDisabled(Context context, Intent intent) {
Toast.makeText(context,
R.string.admin_deactivate, Toast.LENGTH_SHORT).show();
SensLock.stopService(context, SensLockService.class);
SensLock.startService(context, NotificationService.class);
SensLock.startService(context, UpdateWidgetService.class);
}
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 51
10.1.3 SensCall
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.Toast;
public class SensCall extends PreferenceActivity implements
OnSharedPreferenceChangeListener{
CheckBox enable, boot, notify;
CheckBoxPreference pref_enable, pref_notify, ans, end;
ListPreference answerGesture, endGesture;
SeekBarPreference timeOut, timeOutEnd;
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.sens_call);
SensLock.savePrefs(SensCall.this, "bootController", true);
enable = (CheckBox) findViewById(R.id.enableCall);
boot = (CheckBox) findViewById(R.id.bootCall);
notify = (CheckBox) findViewById(R.id.notifyCall);
pref_enable = (CheckBoxPreference) findPreference("prefEnableCall");
pref_notify = (CheckBoxPreference)
findPreference("prefShowNotifyCall");
timeOut = (SeekBarPreference) findPreference("prefAnswerTimeout");
timeOutEnd = (SeekBarPreference) findPreference("prefEndTimeout");
ans = (CheckBoxPreference) findPreference("prefAnswerCall");
end = (CheckBoxPreference) findPreference("prefEndCall");
answerGesture = (ListPreference) findPreference("prefAnswerGesture");
String currentValue = answerGesture.getValue();
endGesture = (ListPreference) findPreference("prefEndGesture");
String currentValueEnd = endGesture.getValue();
if (currentValue == null) {
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 52
answerGesture.setValue((String)answerGesture.getEntryValues()[R.array.ans
werGestureValues]);
currentValue = answerGesture.getValue();
}
updateActionSummary(currentValue);
if (currentValueEnd == null) {
endGesture.setValue((String)endGesture.getEntryValues()[R.array.endGesture
Values]);
currentValueEnd = endGesture.getValue();
}
updateActionEndSummary(currentValueEnd);
answerGesture.setOnPreferenceChangeListener(new
OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue)
{
updateActionSummary(newValue.toString());
return true;
}
});
endGesture.setOnPreferenceChangeListener(new
OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue)
{
updateActionEndSummary(newValue.toString());
return true;
}
});
pref_enable.setOnPreferenceChangeListener (new
OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference
preference,
Object newValue) {
if(SensLock.loadPrefs(SensCall.this, "IsFirstCall",
true))
{
SensLock.savePrefs(SensCall.this, "IsFirstCall",
false);
}
if((Boolean) newValue)
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 53
{
pref_enable.setTitle(R.string.pref_disable_call);
pref_enable.setSummary(R.string.pref_disable_call_summary);
}
else
{
pref_enable.setTitle(R.string.pref_enable_call);
pref_enable.setSummary(R.string.pref_enable_call_summary);
}
SensLock.startService(SensCall.this,
CallNotificationService.class);
SensLock.startService(SensCall.this,
UpdateWidgetService.class);
return true;
}
});
}
}
10.1.4 SensTorch
import android.app.Service;
import android.content.Intent;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
public class SensTorchService extends Service{
private Camera camera = null;
private Parameters params;
private Boolean isOn=false, isStrobeRunning=false,
isAutoOffRunning=false;;
private Handler mHandler = new Handler();
private Handler offHandler = new Handler();
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
getCamera();
btnOnLogic();
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 54
return(START_NOT_STICKY);
}
private Runnable startStrobe = new Runnable() {
public void run()
{
if(isOn)
{
flashLightOff();
}
else
{
flashLightOn();
}
mHandler.postDelayed(this,
SensLock.loadPrefs(SensTorchService.this, "prefDelayTime", 5)*100);
}
};
private Runnable startAutoOff = new Runnable() {
public void run()
{
torchOffLogic();
}
};
private void getCamera()
{
if (camera == null) {
try {
camera = Camera.open();
params = camera.getParameters();
} catch (RuntimeException e) {
Log.e("Camera Error. Failed to Open. Error: ", e.getMessage());
}
}
}
private void btnOffLogic()
{
torchOffLogic();
if(isAutoOffRunning)
{
offHandler.removeCallbacks(startAutoOff);
isAutoOffRunning=false;
}
}
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 55
private void btnOnLogic()
{
torchOnLogic();
if(SensLock.loadPrefs(SensTorchService.this, "IsAutoOff", false))
{
offHandler.postDelayed(startAutoOff,
SensLock.loadPrefs(SensTorchService.this, "prefAutoOffTime", 1)*60000);
isAutoOffRunning=true;
}
}
10.1.5 SensMusic
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.widget.Toast;
public class SensMusicWidgetClickListener extends Service{
@Override
public void onCreate(){
updateWidgetState();
stopSelf();
}
@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
public void updateWidgetState()
{
if(SensLock.loadPrefs(SensMusicWidgetClickListener.this,
"AccelerometerSensor", true))
{
if(SensLock.loadPrefs(SensMusicWidgetClickListener.this,
"prefEnableMusic", false))
{
SensLock.stopService(SensMusicWidgetClickListener.this,
SensMusicService.class);
SensLock.savePrefs(SensMusicWidgetClickListener.this, "prefEnableMusic",
false);
}
else
{
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 56
SensLock.startService(SensMusicWidgetClickListener.this,
SensMusicService.class);
SensLock.savePrefs(SensMusicWidgetClickListener.this, "prefEnableMusic",
true);
}
if(SensLock.loadPrefs(SensMusicWidgetClickListener.this,
"prefShowNotifyMusic", false))
{
SensLock.startService(SensMusicWidgetClickListener.this,
MusicNotificationService.class);
}
}
else
{
SensLock.stopService(SensMusicWidgetClickListener.this,
SensMusicService.class);
SensLock.savePrefs(SensMusicWidgetClickListener.this,
"prefEnableMusic", false);
Toast.makeText(this,R.string.text_hint_no_accemtr,
Toast.LENGTH_SHORT).show();
}
SensLock.startService(SensMusicWidgetClickListener.this,
UpdateWidgetService.class);
}
}
10.2 XML Coding
10.2.1 Main Menu
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/SensActionsHeader"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_alignParentTop="true"
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 57
android:background="@drawable/sens_actions_banner" >
<ImageView
android:id="@+id/headerAppIcon"
android:layout_width="40.0dip"
android:layout_height="35.0dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15.0dip"
android:layout_marginTop="8.0dip"
android:src="@drawable/ic_sens_actions" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentTop="true"
android:layout_marginTop="10.0dip"
android:layout_marginLeft="10.0dip"
android:layout_toRightOf="@id/headerAppIcon"
android:maxLines="1"
android:text="@string/app_name"
style="@style/LargeTitleWithShadow"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="20.0dip"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20.0dip"
android:maxLines="3"
android:maxWidth="230.0dip"
android:text="@string/sens_tag_line"
android:textColor="@color/white"
android:textSize="18.0sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/bottomBar"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="@drawable/bg_bottom" >
<TextView
android:id="@+id/textEnActions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20.0dip"
android:layout_centerVertical="true"
android:maxLines="3"
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 58
android:maxWidth="230.0dip"
android:text="@string/no_actions"
android:textColor="@color/white"
android:textSize="20dp" />
<HorizontalScrollView
android:drawingCacheQuality="low"
android:animationCache="false"
android:alwaysDrawnWithCache="false"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10.0dip"
android:layout_centerVertical="true"
android:overScrollMode="never"
android:layout_toRightOf="@id/textEnActions"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:animateLayoutChanges="true">
<ImageView
android:id="@+id/enSensLock"
android:layout_width="40.0dip"
android:layout_height="40.0dip"
android:layout_marginLeft="10.0dip"
android:src="@drawable/ic_sens_lock"/>
<ImageView
android:id="@+id/enSensMusic"
android:layout_width="40.0dip"
android:layout_height="40.0dip"
android:layout_marginLeft="10.0dip"
android:src="@drawable/ic_sens_music"/>
<ImageView
android:id="@+id/enSensCall"
android:layout_width="40.0dip"
android:layout_height="40.0dip"
android:layout_marginLeft="10.0dip"
android:src="@drawable/ic_sens_call"/>
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
10.2.2 Help Menu
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 59
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_caution"
android:textSize="28sp"
android:textColor="@color/light_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_caution_desc"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/menu_help"
android:textSize="28sp"
android:textColor="@color/light_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_desc"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_apply_on_boot"
android:textSize="28sp"
android:textColor="@color/light_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_apply_on_boot_desc"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 60
android:layout_height="wrap_content"
android:text="@string/help_notifi"
android:textSize="28sp"
android:textColor="@color/light_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_notifi_desc"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_widgets"
android:textSize="28sp"
android:textColor="@color/light_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_widgets_desc"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pref_uninstall"
android:textSize="28sp"
android:textColor="@color/light_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_uninstall_desc"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
10.2.3 About
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 61
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
<ImageView
android:id="@+id/SensLock"
android:contentDescription="@string/sens_lock_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:src="@drawable/sens_actions" >
</ImageView>
<TextView
android:id="@+id/txtVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sens_lock_version"
android:textSize="16sp"
android:layout_gravity="center"
android:textStyle="bold" />
<View
android:id="@+id/divider"
android:layout_width="fill_parent"
android:layout_height="4dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@drawable/divider_horizontal_dark_opaque"/>
<TextView
android:id="@+id/txtSensLock"
android:layout_width="wrap_content"
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 62
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="@string/sens_lock_summary"
android:textSize="17sp"
android:layout_gravity="center"/>
<TextView
android:id="@+id/txtReview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="@string/sens_review_summary"
android:textSize="17sp"
android:layout_gravity="center"/>
<TextView
android:id="@+id/txtRate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginBottom="20dp"
android:text="@string/sens_rate_summary"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="@color/light_blue"
android:layout_gravity="center"/>
</LinearLayout>
</ScrollView>
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 63
10.2.4 Widget and Animator
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_caution"
android:textSize="28sp"
android:textColor="@color/light_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_torch_caution_desc"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 64
android:text="@string/help_torch_strobe"
android:textSize="28sp"
android:textColor="@color/light_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_torch_strobe_desc"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_torch_strobe_freq"
android:textSize="28sp"
android:textColor="@color/light_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_torch_strobe_freq_desc"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:background="@drawable/lock_disabled"
android:id="@+id/torch_bg">
<Button
android:id="@+id/btnTorchEnable"
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 65
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_sens_torch"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:text="@string/torch_help_text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/light_blue"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="40dp"
android:layout_marginTop="55dp"
android:src="@drawable/sens_torch_help" />
</RelativeLayout>
10.2.5 Sliding Tabs
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 66
xmlns:pranavpandey="http://schemas.android.com/apk/res/com.pranavpandey.sen
slock"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.pranavpandey.senslock.SlidingTabs
android:id="@+id/slidingtabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
pranavpandey:bottomBarColor="#ff96aa39"
pranavpandey:bottomBarHeight="2dip"
pranavpandey:tabIndicatorHeight="3dip"
android:background="#ff3b3b3b"/>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/help_button_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/help_button_ok"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/ok" />
</LinearLayout>
</LinearLayout>
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 67
Chapter - 11
Snapshots
11.1 Main Application Menu
Fig 11.1:With no actionsenabled Fig 11.2:With three actions enabled
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 68
11.2 Supported Actions
Fig 11.3:Action for SensCall Fig 11.4:Action for SensMusic
Fig 11.5:Action for SensLock Fig 11.6:Action for SensTorch
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 69
11.3 Modules
Fig 11.7: SensCall Fig 11.8: SensMusic
Fig 11.9: SensLock Fig 11.10: SensTorch
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 70
11.4 Help and About
Fig 11.11:SensCall Help Fig 11.12:SensMusic Help
Fig 11.13:SensTorch Help Fig 11.14:SensLock Help
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 71
Fig 11.15:SensActionsHelp Fig 11.16:About SensActions
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 72
11.5 SensActions Widgets
Fig 11.17:WidgetsActivated Fig 11.18:Widgets Deactivated
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 73
Chapter - 12
Testing and Maintenance
12.1 Testing
The completion of a system is achieved only after it has been thoroughly tested.
Though this gives a feel the project is completed, there cannot be any project without
going through this stage. Though the programmer may have taken many precautions
not to commit any mistakes that crop up during the execution stage.
Hence in this stage it is decided whether the project can undergo the real time
environment execution without any break downs, therefore a package can be rejected
even at this stage.
The testing phase involves the testing of the developed system using various kinds
of data. An elaborated testing of data is prepared and a system is tested using the test
data. While testing, errors are noted and corrections remade, the corrections are also
noted for future use.
Software testing is an investigation conducted to provide stakeholders with
information about the quality of the product or service under test. Software testing can
also provide an objective, independent view of the software to allow the business to
appreciate and understand the risks of software implementation. Test techniques
include, but are not limited to, the process of executing a program or application with
the intent of finding software bugs (errors or other defects).
Software testing can be stated as the process of validating and verifying that a
computer program/application/product:
Meets the requirements that guided its design and development, works as
expected, can be implemented with the same characteristics, and satisfies the needs of
stakeholders.
12.1.1 Visual Testing
The aim of visual testing is to provide developers with the ability to examine what
was happening at the point of software failure by presenting the data in such a way
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 74
that the developer can easily find the information he requires, and the information is
expressed clearly.At the core of visual testing is the idea that showing someone a
problem (or a test failure), rather than just describing it, greatly increases clarity and
understanding. Visual testing therefore requires the recording of the entire test process
– capturing everything that occurs on the test system in video format. Output videos
are supplemented by real-time tester input via picture-in-a-picture webcam and audio
commentary from microphones. Visual testing provides a number of advantages. The
quality of communication is increased dramatically because testers can show the
problem (and the events leading up to it) to the developer as opposed to just
describing it and the need to replicate test failures will cease to exist in many cases.
The developer will have all the evidence he requires of a test failure and can instead
focus on the cause of the fault and how it should be fixed.
12.1.2 Acceptance Testing
Tested SensActions on different devices and versions of Android. We have used
devices from different manufacturers:
 Sony (Ericsson)
 LG
 Samsung
 Micromax
 Xolo
 Motorola
We have also tested it on the different versions of android:
 2.3.x (Gingerbread)
 4.0.x (Ice-cream Sandwich)
 4.1.x - 4.3.x (Jelly Bean)
 4.4.x (KitKat)
12.2 Maintenance
Once the software is delivered and developed, it enters the maintenance phase.
After implementation systems need maintenance. Beyond monkey testing during
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 75
Software development some errors may not appear. During its usage by the end-user
with actual data certain errors may disclose.
Therefore some residual errors or bugs remain in the system that must be
removed as they are discovered. Many of these surfaces only after the system have
been in operation sometimes for a long time. These errors once discovered need to be
removed on an urgent basis for the smooth running of the system, leading to the
software getting hanged.
Though Maintenance is not a part of software development, it is an extremely
important activity in the life of a software product. Maintenance involves
understanding the existing software (code and related documents), understanding the
effects of change, making the changes-to both the code and documents-testing the
new parts and retesting the old part. For successful and smooth running of the system,
maintenance is the prominent part of the project.
Any error, which hinders the functioning of any part of the project, may lead
to bad impression of the developer.
There are majorly two types of errors: Compilation error and Runtime
errors. Compilation errors are errors during coding and are to be taken care of by the
developer during development process.
Runtime errors are those which occurs during running of the program.
Whenever there is an occurrence of error an ‘Error Window’ opens in the middle of
the screen displaying the type of error, Error Number and the Nearest Possible reason
as to why the error has occurred. With the occurrence of this Error Window the
operator (End-user) should note the type of error, the error number and the description
of the error and should immediately report to the concerned Developer or
Administrator.
Now is the role of the Maintenance Personals. After knowing the entire details
from the end-user like where or at which screen does this error occurred or what type
of data was fed by the user or the point of malfunctioning. Considering this error as
the main reason for the malfunctioning the programmer now re-examines all the
possible factors, which act behind the particular screen where error has occurred.
After debugging the required error the programmer itself tests the same screen
or process with dummy data. Only after getting completely satisfied with problem
rectification the programmer compiles and runs the program.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 76
Chapter -13
Conclusion and Future Scope
13.1 Conclusion
SensActions have been developed to satisfy the user’s changing need to
communicate and interact with his/her device in a better way. SensActions
extensively uses the hardware features provided with modern computing devices and
leverages the power of almost all of the sensors provided on the smartphones and
gives the user to interact with the device with the help of familiar gestures which
prove to be more intuitive in nature for human beings.
SensActions implements the concept of next generation smartphones. It can act as
a substitute for hardware keys present on the mobile as we can use gestures in place of
the keys, hence preventing their degradation. It essentially fills the gap between
flagship and mid-range or older devices as now even the older devices can use gesture
based features provided with the latest and high end devices.
Using SensActions on a smartphone gives a convenient way for visually disabled
or people with poor vision to operate the latest touch screen devices.
SensActions provides the best way to protect hardware keys and sometimes it can
also be used for entertainment purposes.
13.2 Future Scope:-
With further improvements in the hardware and the number of accurate and high quality
sensors provided with mobile devices SensActions can further be developed to encapsulate
many other features which will come with advancement in the technology like:
* Reading the room temperature levels
* Measuring the calorie count in the body
*Measuring the pulse rate of a patient.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 77
* With advancement in x-ray technology it can be used to take inner body x-rays.
* It will be very helpful to develop button-less operations in the future.
* Can be extended to recognise facial gestures.
* Measuring the atmospheric pressure around the device.
* Measuring the ground level height.
* Can be used as metal detector.
* Can be used to measure the magnetic field and emf produced in a conductor.
* Gestures can also be used to sync and control other electronic devices.
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 78
Bibliography
[1]. Java Complete Reference …...………………………… Herbert Shildt
[2]. Beginning Android ………………………………........... Wei-Meng Lee
[3]. Professional Android App Development ………. Reto Meier
[4]. Hello, Android ……………………………………………… Ed Burnette
SensActions 2014
Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 79
References
[1].Android Official Webpage
http://www.android.com
[2]. Official Android Google Code Webpage
http://code.google.com/android/
[3]. Open Handset Alliance Webpage
http://www.openhandsetalliance.com/
[4]. Android Wiki
http://www.androidwiki.com
[5]. Official Google Blog
http://googleblog.blogspot.com/
[6]. Wikipedia Information
http://en.wikipedia.org/wiki/Android
http://en.wikipedia.org/wiki/SQLite
http://en.wikipedia.org/wiki/WebKit
http://en.wikipedia.org/wiki/Eclipse

More Related Content

What's hot

Windows phone
Windows phoneWindows phone
Windows phone
Rishabha Garg
 
Android architecture
Android architectureAndroid architecture
Android architecture
Kartik Kalpande Patil
 
Android mobile os final
Android mobile os finalAndroid mobile os final
Android mobile os final
Amar Shah
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
master760
 
Android Design Patterns in Mobile Application Development - Michalis Grigorop...
Android Design Patterns in Mobile Application Development - Michalis Grigorop...Android Design Patterns in Mobile Application Development - Michalis Grigorop...
Android Design Patterns in Mobile Application Development - Michalis Grigorop...
Michail Grigoropoulos
 
Android overview
Android overviewAndroid overview
Android overview
Ahmed M. Abed
 
Android OS PPT
Android OS PPTAndroid OS PPT
Android OS PPT
ganesh mate
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
Ramesh Prasad
 
Introduction to Android App Development
Introduction to Android App DevelopmentIntroduction to Android App Development
Introduction to Android App Development
Andri Yadi
 
Introduction to Android
Introduction to Android Introduction to Android
Introduction to Android
Ranjith Kumar
 
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINESTUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
AIRCC Publishing Corporation
 
Android Platform Architecture
Android Platform ArchitectureAndroid Platform Architecture
Android Platform Architecture
Naresh Chintalcheru
 
Ch1 hello, android
Ch1 hello, androidCh1 hello, android
Ch1 hello, android
Jehad2012
 
Android
AndroidAndroid
Mobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osamaMobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osama
Osama Ghandour Geris
 
ANDROID MOBILE OPERATING SYSTEM
ANDROID MOBILE OPERATING SYSTEMANDROID MOBILE OPERATING SYSTEM
ANDROID MOBILE OPERATING SYSTEM
preeta sinha
 
Introduction to Android - Mobile Portland
Introduction to Android - Mobile PortlandIntroduction to Android - Mobile Portland
Introduction to Android - Mobile Portland
sullis
 
Android basics
Android basicsAndroid basics
Android basics
Syed Luqman Quadri
 
Android seminar report
Android seminar reportAndroid seminar report
Android seminar report
dgpune
 
Short notes of android
Short notes of androidShort notes of android
Short notes of android
Mohamed Fathy
 

What's hot (20)

Windows phone
Windows phoneWindows phone
Windows phone
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android mobile os final
Android mobile os finalAndroid mobile os final
Android mobile os final
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android Design Patterns in Mobile Application Development - Michalis Grigorop...
Android Design Patterns in Mobile Application Development - Michalis Grigorop...Android Design Patterns in Mobile Application Development - Michalis Grigorop...
Android Design Patterns in Mobile Application Development - Michalis Grigorop...
 
Android overview
Android overviewAndroid overview
Android overview
 
Android OS PPT
Android OS PPTAndroid OS PPT
Android OS PPT
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 
Introduction to Android App Development
Introduction to Android App DevelopmentIntroduction to Android App Development
Introduction to Android App Development
 
Introduction to Android
Introduction to Android Introduction to Android
Introduction to Android
 
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINESTUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
 
Android Platform Architecture
Android Platform ArchitectureAndroid Platform Architecture
Android Platform Architecture
 
Ch1 hello, android
Ch1 hello, androidCh1 hello, android
Ch1 hello, android
 
Android
AndroidAndroid
Android
 
Mobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osamaMobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osama
 
ANDROID MOBILE OPERATING SYSTEM
ANDROID MOBILE OPERATING SYSTEMANDROID MOBILE OPERATING SYSTEM
ANDROID MOBILE OPERATING SYSTEM
 
Introduction to Android - Mobile Portland
Introduction to Android - Mobile PortlandIntroduction to Android - Mobile Portland
Introduction to Android - Mobile Portland
 
Android basics
Android basicsAndroid basics
Android basics
 
Android seminar report
Android seminar reportAndroid seminar report
Android seminar report
 
Short notes of android
Short notes of androidShort notes of android
Short notes of android
 

Viewers also liked

SensActions-Presentation
SensActions-PresentationSensActions-Presentation
SensActions-Presentation
Pranav Pandey
 
3d password - Report
3d password - Report  3d password - Report
3d password - Report
Sunanda Bansal
 
The 2016 IT Trend Showcase
The 2016 IT Trend ShowcaseThe 2016 IT Trend Showcase
The 2016 IT Trend Showcase
flowil
 
3D Password PPT
3D Password PPT3D Password PPT
3D Password PPT
Seminar Links
 
RAIN TECHNOLOGY
RAIN TECHNOLOGYRAIN TECHNOLOGY
RAIN TECHNOLOGY
127r1a05h9
 
Rain technology
Rain technologyRain technology
Rain technology
Yamuna Devi
 
3d password ppt
3d password ppt3d password ppt
3d password ppt
Gowsalyasri
 
Latest trends in information technology
Latest trends in information technologyLatest trends in information technology
Latest trends in information technology
Eldos Kuriakose
 
Best topics for seminar
Best topics for seminarBest topics for seminar
Best topics for seminar
shilpi nagpal
 
Project report-on-student-information-management-system-php-mysql
Project report-on-student-information-management-system-php-mysqlProject report-on-student-information-management-system-php-mysql
Project report-on-student-information-management-system-php-mysql
Raj Sharma
 

Viewers also liked (10)

SensActions-Presentation
SensActions-PresentationSensActions-Presentation
SensActions-Presentation
 
3d password - Report
3d password - Report  3d password - Report
3d password - Report
 
The 2016 IT Trend Showcase
The 2016 IT Trend ShowcaseThe 2016 IT Trend Showcase
The 2016 IT Trend Showcase
 
3D Password PPT
3D Password PPT3D Password PPT
3D Password PPT
 
RAIN TECHNOLOGY
RAIN TECHNOLOGYRAIN TECHNOLOGY
RAIN TECHNOLOGY
 
Rain technology
Rain technologyRain technology
Rain technology
 
3d password ppt
3d password ppt3d password ppt
3d password ppt
 
Latest trends in information technology
Latest trends in information technologyLatest trends in information technology
Latest trends in information technology
 
Best topics for seminar
Best topics for seminarBest topics for seminar
Best topics for seminar
 
Project report-on-student-information-management-system-php-mysql
Project report-on-student-information-management-system-php-mysqlProject report-on-student-information-management-system-php-mysql
Project report-on-student-information-management-system-php-mysql
 

Similar to SensActions-Report

Google android white paper
Google android white paperGoogle android white paper
Google android white paper
Sravan Reddy
 
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-ass
ARVIND SARDAR
 
Android architecture
Android architectureAndroid architecture
Android architecture
Saurabh Kukreja
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
Swapnali Pawar
 
Android
Android Android
Android
Anand Buddarapu
 
Android architecture
Android architectureAndroid architecture
Android architecture
Hari Krishna
 
Android...by raziel lucagbo
Android...by raziel lucagboAndroid...by raziel lucagbo
Android...by raziel lucagbo
Guevarra Institute of Technology
 
Android and its applications
Android and its applicationsAndroid and its applications
Android and its applications
Soba Arjun
 
Android platform
Android platform Android platform
Android platform
Rashmi Warghade
 
Accident detection
Accident detection Accident detection
Accident detection
Samana Rao
 
Android
AndroidAndroid
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
ABHISHEK DINKAR
 
Know all about android development
Know all about android developmentKnow all about android development
Know all about android development
Deepika Chaudhary
 
Android Architecture and Working
Android Architecture and WorkingAndroid Architecture and Working
Android Architecture and Working
AnkurVeer1
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
zeelpatel0504
 
Android..overwiew
Android..overwiewAndroid..overwiew
Android..overwiew
Sai Teja
 
Android technology
Android technologyAndroid technology
Android technology
Dhruv Modh
 
Wifi Direct Based Chat And File Transfer Android Application
Wifi Direct Based Chat And File Transfer Android ApplicationWifi Direct Based Chat And File Transfer Android Application
Wifi Direct Based Chat And File Transfer Android Application
Nitin Bhasin
 
Evolution of Android Operating System and it’s Versions
Evolution of Android Operating System and it’s VersionsEvolution of Android Operating System and it’s Versions
Evolution of Android Operating System and it’s Versions
ijtsrd
 
rakesh
rakeshrakesh

Similar to SensActions-Report (20)

Google android white paper
Google android white paperGoogle android white paper
Google android white paper
 
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-ass
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android
Android Android
Android
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android...by raziel lucagbo
Android...by raziel lucagboAndroid...by raziel lucagbo
Android...by raziel lucagbo
 
Android and its applications
Android and its applicationsAndroid and its applications
Android and its applications
 
Android platform
Android platform Android platform
Android platform
 
Accident detection
Accident detection Accident detection
Accident detection
 
Android
AndroidAndroid
Android
 
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
 
Know all about android development
Know all about android developmentKnow all about android development
Know all about android development
 
Android Architecture and Working
Android Architecture and WorkingAndroid Architecture and Working
Android Architecture and Working
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android..overwiew
Android..overwiewAndroid..overwiew
Android..overwiew
 
Android technology
Android technologyAndroid technology
Android technology
 
Wifi Direct Based Chat And File Transfer Android Application
Wifi Direct Based Chat And File Transfer Android ApplicationWifi Direct Based Chat And File Transfer Android Application
Wifi Direct Based Chat And File Transfer Android Application
 
Evolution of Android Operating System and it’s Versions
Evolution of Android Operating System and it’s VersionsEvolution of Android Operating System and it’s Versions
Evolution of Android Operating System and it’s Versions
 
rakesh
rakeshrakesh
rakesh
 

SensActions-Report

  • 1. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 1 Chapter - 1 Introduction 1.1 Introduction to SensActions It is an Android application which uses various sensors present on the device to perform different functions. It includes Proximity sensor, Accelerometer sensor, Microphone, Camera and Camera flashlight. SensAction is a combination of different small actions by which user can interacts with their smartphone in a convenient and smarter way. There are different gestures from which user can select to perform different actions. Fig1.1:SensActions Logo SensActions is built to perform various actions without using the key in a quicker and smarter way. It uses different sensors present on the device to perform different actions. SensActions can make any device able to respond your shakes and swipes/waves like any other flagship device. Even some time for fun also. Its functions include: swiping over the proximity sensor to lock/unlock the device or to answer/end a call, using camera’s flash light as a torch or to send SOS signals using Morse codes. It also include the functionality to change the currently playing song and to silent the incoming call by shaking the device which is done with the help of accelerometer of the mobile.
  • 2. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 2 1.2 Purpose of Project Caution SensActions performs various tasks in the background. So, for best results exclude it from task killer (if any). If after sometime SensActions does not perform desired actions then, tap on its icon and start your action(s) again. Help You can view this help anytime to sort out general issues and to understand the functioning of SensActions. To view help from main screen, Tap on Menu button or icon -> Help. Uninstall To unsinstall SensActions first you have to remove it from Device Administrator (if activated). After that you can perform normal uninstall. You can also do this from SensActions Menu, Tap on SensActions icon -> Menu button or icon -> Uninstall. Widgets SensActions also supports seven type of Widgets. To add those widgets, Long press on home screen -> Widgets ->Then select from SensLock, SensMusic or SensCall widgets. 1.3 Project Objectives 1. SensLock:- It is a part of SensActions which locks/unlocks the device by using proximity sensor. When users put their phone in cover or pocket it automatically locks the device and unlock it when the user removes it from pocket or cover.
  • 3. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 3 2. SensTorch:- By this we can use our Camera flashlight as a torch. Strobe or SOS feature is also available in to use it in emergency situations. 3. SensMusic:- It changes the music tracks according to the direction of shake (Right shake - Play Next and Left Shake - Play previous). It uses the accelerometer sensor to detect shake actions. We can also select the shake threshold which defines how harder we have to shake. 4. SensCall:- It uses the proximity sensor to answer or end calls. Call will be automatically answered when user puts his phone closer to ear and disconnected when away from the ear. There are different gestures available like wave once/twice etc.
  • 4. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 4 Chapter - 2 System Analysis The term “Android” has its origin in the Greek word andr-, meaning “man or male” and the suffix -aides, used to mean “alike or of the species”. This together means as much as “being human”. Android is a software stack for mobile devices which means a reference to a set of system programs or a set of application programs that form a complete system. This software platform provides a foundation for applications just like a real working platform.Android is a software stack for mobile devices that includes an operating system, middleware and key applications. Android is a software platform and operating system for mobile devices based on the Linux operating system and developed by Google and the Open Handset Alliance. It allows developers to write managed code in a Java-like language that utilizes Google-developed Java libraries, but does not support programs developed in native code. The unveiling of the Android platform on 5 November 2007 was announced with the founding of the Open Handset Alliance, a consortium of 34 hardware, software and telecom companies devoted to advancing open standards for mobile devices. When released in 2008, most of the Android platform will be made available under the Apache free-software and open-source license. 2.1 Existing System In July 2005, Google acquired Android Inc., a small startup company based in Palo Alto, CA. Android's co-founders who went to work at Google included Andy Rubin (co-founder of Danger), Rich Miner (co-founder of Wildfire Communications, Inc), Nick Sears (once VP at T-Mobile), and Chris White (one of the first engineers at WebTV). At the time, little was known about the functions of Android Inc. other than they made software for mobile phones. At Google, the team, led by Rubin, developed a Linux-based mobile device OS which they marketed to handset makers and carriers on the premise of providing a
  • 5. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 5 flexible, upgradeable system.It was reported that Google had already lined up a series of hardware component and software partners and signaled to carriers that it was open to various degrees of cooperation on their part. 2.2 Proposed System On 5 November 2007, the Open Handset Alliance, a consortium of several companies which include Google, HTC, Intel, Motorola, Qualcomm, T-Mobile, Sprint Nextel and NVIDIA, was unveiled with the goal to develop open standards for mobile devices. Along with the formation of the Open Handset Alliance, the OHA also unveiled their first product, Android, an open source mobile device platform based on the Linux operating system. 2.3. Feasibility Study Google has unveiled at least three prototypes for Android, at the Mobile World Congress on February 12, 2008. A prototype at the Google IO conference on May 28, 2008 had a 528 MHz Qualcomm processor and a Synaptic capacitive touch screen, and used the UMTS cellular standard. It had 128 MB of RAM and 256 MB of flash, showing that Android's memory requirements are reasonable.
  • 6. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 6 Chapter - 3 Literature Survey 3.1 Application Framework It is used to write applications for Android. Unlike other embedded mobile environments, Android applications are all equal, for instance, an applications which come with the phone are no different than those that any developer writes.The framework is supported by numerous open source libraries such as openssl, SQLite and libc. It is also supported by the Android core libraries. From the point of security, the framework is based on UNIX file system permissions that assure applications have only those abilities that mobile phone owner gave them at install time. 3.2 Dalvik Virtual Machine It is extremely low-memory based virtual machine, which was designed especially for Android to run on embedded systems and work well in low power situations. It is also tuned to the CPU attributes. The Dalvik VM creates a special file format (.DEX) that is created through build time post processing. Conversion between Java classes and .DEX format is done by included “dx” tool. 3.3 Integrated Browser Google made a right choice on choosing WebKit as open source web browser. They added a two pass layout and frame flattening. Two pass layout loads a page without waiting for blocking elements, such as external CSS or external JavaScript and after a while renders again with all resources downloaded to the device. Frame flattening converts founded frames into single one and loads into the browser. These features increase speed and usability browsing the internet via mobile phone.
  • 7. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 7 3.4 Optimized Graphics As Android has 2D graphics library and 3D graphics based on OpenGL ES 1.0, possibly we will see great applications like Google Earth and spectacular games like Second Life, which come on Linux version. At this moment, the shooting legendary 3D game Doom was presented using Android on the mobile phone. 3.5 SQLite Extremely small (~500kb) relational database management system, which is integrated in Android. It is based on function calls and single file, where all definitions, tables and data are stored. This simple design is more than suitable for a platform such as Android. 3.6 Handset Layouts The platform is adaptable to both larger, VGA, 2D graphics library, 3D graphics library based on OpenGL ES 1.0 specifications, traditional smart phone layouts. An underlying 2D graphics engine is also included. Surface Manager manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications 3.7 Data Storage SQLite is used for structured data storage .SQLite is a powerful and lightweight relational database engine available to all applications. 3.8 Connectivity Android supports a wide variety of connectivity technologies including GSM, CDMA, Bluetooth, EDGE, EVDO, 3G and Wi-Fi.
  • 8. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 8 3.9 Messaging SMS, MMS, and XMPP are available forms of messaging including threaded text messaging. 3.10 Web Browser The web browser available in Android is based on the open-source WebKit application framework. It includes LibWebCore which is a modern web browser engine which powers both the Android browser and an embeddable web view. 3.11 Java Virtual Machine Software written in Java can be compiled into Dalvik bytecodes and executed in the Dalvik virtual machine, which is a specialized VM implementation designed for mobile device use, although not technically a standard Java Virtual Machine. 3.12 Media Support Android will support advanced audio/video/still media formats such as MPEG-4, H.264, MP3, and AAC, AMR, JPEG, PNG, GIF. 3.13 Additional Hardware Support Android is fully capable of utilizing video/still cameras, touchscreens, GPS, compasses, accelerometers, and accelerated 3D graphics. 3.14 Development Environment Includes a device emulator, tools for debugging, memory and performance profiling, a plugin for the Eclipse IDE. There are a number of hardware dependent features, for instance, a huge media and connections support for GPS.
  • 9. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 9 Chapter - 4 Research, Hypothesis, Design, Methodology Android is hailed as “the first complete, open, and free mobile platform”. a) Complete: The designers took a comprehensive approach when they developed the Androidplatform.They began with a secure operating system and built a robust software framework on top that allows for rich application development opportunities. b) Open: The Android platform is provided through open source licensing. Developers have unprecedented access to the handset features when developing applications. c) Free: Android applications are free to develop.There are no licensing or royalty fees to develop on the platform. No required membership fees. No required testing fees.No required signing or certification fees.Android applications can be distributed and commercialized in a variety of ways. 4.1 Runtime Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language.Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included "dx" tool.The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.
  • 10. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 10 4.2 Linux Kernel Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack. It helps to manage security, memory management, process management, network stack and other important issues. Therefore, the user should bring Linux in his mobile device as the main operating system and install all the drivers required in order to run it. Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user.Underlying all applications is a set of services and systems. 4.3 Architecture The following diagram shows the major components of the Android operating system. Each section is described in more detail below.
  • 11. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 11 Fig 4.1: Architecture of Android Android Architecture is based on Linux 2.6 kernel. It helps to manage security, memory management, process management, network stack and other important issues. Therefore, the user should bring Linux in his mobile device as the main operating system and install all the drivers required in order to run it. Android provides the support for the Qualcomm MSM7K chipset family. For instance, the current kernel tree supports Qualcomm MSM 7200A chipsets, but in the second half of 2008 we should see mobile devices with stable version Qualcomm MSM 7200, which includes major features: a) WCDMA/HSUPA and EGPRS network support b) Bluetooth 1.2 and Wi-Fi support
  • 12. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 12 c) Digital audio support for mp3 and other formats d) Support for Linux and other third-party operating systems e) Java hardware acceleration and support for Java applications f) Camera up to 6.0 megapixels g) And lots of other. 4.4 Libraries In the next level there are a set of native libraries written in C/C++, which are responsible for stable performance of various components. For example, Surface Manager is responsible for composing different drawing surfaces on the mobile screen. It manages the access for different processes to compose 2D and 3D graphic layers.OpenGL ES and SGL make a core of graphic libraries and are used accordingly for 3D and 2D hardware acceleration. Moreover, it is possible to use 2D and 3D graphics in the same application in Android. The media framework was provided by PacketVideo, one of the members of OHA. It gives libraries for a playback and recording support for all the major media and static image files. FreeType libraries are used to render all the bitmap and vector fonts. For data storage, Android uses SQLite. As mentioned before, it is extra light rational management system, which locates a single file for all operations related to database. WebKit, the same browser used by Apple Safari, was modified by Android in order to fit better in a small size screens. 4.5 Android Runtime At the same level there is Android Runtime, where the main component Dalvik Virtual Machine is located. It was designed specifically for Android running in limited environment, where the limited battery, CPU, memory and data storage are the main issues. Android gives an integrated tool dx, which converts generated byte code from .jar to .dex file, after this byte code becomes much more efficient to run on the small processors.
  • 13. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 13 Fig 4.2: Conversion from .java to .dex file As the result, it is possible to have multiple instances of Dalvik virtual machine running on the single device at the same time. The Core libraries are written in Java language and contains of the collection classes, the utilities, IO and other tools. 4.6 Application Layer After that, there is Application Framework, written in Java language. It is a toolkit that all applications use, ones which come with mobile device like Contacts or SMS box, or applications written by Google and any Android developer. It has several components. The Activity Manager manages the life circle of the applications and provides a common navigation back stack for applications, which are running in different processes. The Package Manager keeps track of the applications, which are installed in the device. The Windows Manager is Java programming language abstraction on the top of lower level services that are provided by the Surface Manager. The Telephony Manager contains of a set of API necessary for calling applications. Content Providers was built for Android to share a data with other applications, for instance, the contacts of people in the address book can be used in other applications too. The Resource Manager is used to store localized strings, bitmaps, layout file descriptions and other external parts of the application. The View
  • 14. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 14 System generates a set of buttons and lists used in UI. Other components like Notification manager is used to customize display alerts and other functions. At the top of Android Architecture we have all the applications, which are used by the final user. By installing different applications, the user can turn his mobile phone into the unique, optimized and smart mobile phone. All applications are written using the Java programming language. 4.6.1 Application Building Blocks We can think of an Android application as a collection of components, of various kinds. These components are for the most part quite loosely coupled, to the degree where you can accurately describe them as a federation of components rather than a single cohesive application. Generally, these components all run in the same system process. It's possible (and quite common) to create multiple threads within that process, and it's also possible to create completely separate child processes if you need to. Such cases are pretty uncommon though, because Android tries very hard to make processes transparent to your code. Google provides three versions of SDK for Windows, for Mac OSX and one for Linux.The developer can use Android plugin for Eclipse IDE or other IDEs such as intelliJ.First step for Android developer is to decompose the prospective application into the components, which are supported by the platform. The major building blocks are: a) Activity b) Intent Receiver c) Service d) Content Provider Activity:User interface component, which corresponds to one screen at time. It means that for the simple application like Address Book, the developer should have one activity for displaying contacts, another activity component for displaying more detailed information of chosen name and etc.
  • 15. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 15 Intent Receiver:Wakes up a predefined action through the external event. For example,for the application like Email Inbox, the developer should have intent receiver and register his code through XML to wake up an alarm notification, when the user receives email. Service:A task, which is done in the background. It means that the user can start an application from the activity window and keep the service work, while browsing other applications. For instance, he can browse Google Maps application while holding a call or listening music while browsing other applications. Content Provider:A component, which allows sharing some of the data with other processes and applications. It is the best way to communicate the applications between each other.Android will ship with a set of core applications including an email client, SMS program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language. 4.6.2 AndroidManifest.xml The AndroidManifest.xml file is the control file that tells the system what to do with all the top-level components (specifically activities, services, intent receivers, and content providers described below) you've created. For instance, this is the "glue" that actually specifies which Intents your Activities receive. A developer should predefine and list all components, which he wants to use in the specific AndroidManifest.xml file. It is a required file for all the applications and is located in the root folder. It is possible to specify all global values for the package, all the components and its classes used, intent filters, which describe where and when the certain activity should start, permissions and instrumentation like security control and testing. Here is an example of AndroidManifest.xml file: 1. <xml version="1.0" encoding="utf-8"> 2. <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3. package="com.pranav.android.hello"> 4. <application android:icon="@drawable/icon"> 5. <activity class=".HelloAndroid" android:label="@string/app_name">
  • 16. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 16 6. <intent-filter> 7. <action android:value="android.intent.action.MAIN" /> 8. <category android:value="android.intent.category.LAUNCHER"/> 9. </intent-filter> 10. </activity> 11. </application> 12. </manifest> The line 2 is a namespace declaration, which makes a standard Android attributes available for that application. In the line 4 there is a single <application> element, where the developer specifies all application level components and its properties used by the package. Activity class in the line 5 represents the initial screen the user sees and it may have one or more <intent-filter> elements to describe the actions that activity supports. 4.6.3 Application Lifecycle In Android, every application runs in its own process, which gives better performance in security, protected memory and other benefits. Therefore, Android is responsible to run and shut down correctly these processes when it is needed. It is important that application developers understand how different application components (in particular Activity, Service, and BroadcastReceiver) impact the lifetime of the application's process. Not using these components correctly can result in the system killing the application's process while it is doing important work. To determine which processes should be killed when low on memory, Android places each process into an "importance hierarchy" based on the components running in them and the state of those components. These process types are (in order of importance). There will only ever be a few such processes in the system, and these will only be killed as a last resort if memory is so low that not even these processes can continue to run. Generally, at this point, the device has reached a memory paging state, so this action is required in order to keep the user interface responsive
  • 17. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 17 a) A foreground process is one that is required for what the user is currently doing. Variousapplication components can cause its containing process to be considered foreground in different ways. A process is considered to be in the foreground if any of the following conditions hold: (i) It is running an Activity at the top of the screen that the user is interacting with(its onResume() method has been called). (ii) It has a BroadcastReceiver that is currently running (its BroadcastReceiver.onReceive() method is executing). (iii) It has a Service that is currently executing code in one of its callbacks (Service.onCreate(), Service.onStart(), or Service.onDestroy()). b) A visible process is one holding an Activity that is visible to the user on-screen but not in theforeground (its onPause() method has been called). This may occur, for example, if the foreground Activity is displayed as a dialog that allows the previous Activity to be seen behind it. Such a process is considered extremely important and will not be killed unlessdoing so is required to keep all the foreground processesrunning. c) A service process is one holding a Service that has been started with the startService() method. Though these processes are not directly visible to the user, they are generally doing things that the user cares about (such as background mp3 playback or background network data upload or download), so the system will always keep such processes running unless there is not enough memory to retain all foreground and visible process. d) A background process is one holding an Activity that is not currently visible to the user (its onStop() method has been called). These processes have no direct impact on the user experience. Provided they implement their Activity life-cycle correctly (see Activity for more details), the system can kill such processes at any time to reclaim memory for one of the three previous processes types. Usually there are many of these processes running, so they are kept in an LRU list to ensure the process that was most recently seen by the user is the last to be killed when running low on memory.
  • 18. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 18 e) An empty process is one that doesn't hold any active application components. The only reason to keep such a process around is as a cache to improve startup time the next time a component of its application needs to run. As such, the system will often kill these processes in order to balance overall system resources between these empty cached processes and the underlying kernel caches. Fig 4.3: Flowchart Showing the Lifecycle of an Activity 4.6.4 Application Framework Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user.
  • 19. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 19 Underlying all applications is a set of services and systems, including: a) A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser . b) Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data. c) A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files. d) A Notification Manager that enables all applications to display custom alerts in the status bar. e) An Activity Manager that manages the life cycle of applications and provides a common navigation back stack. 4.6.5 Library Android includes a set of C/C++ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application framework. Some of the core libraries are listed below: a) System C library: a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices. b) Media Libraries: based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. c) Surface Manager: manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications. d) LibWebCore: a modern web browser engine which powers both the Android browser and an embeddable web view. e) 3D libraries: an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly
  • 20. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 20 optimized 3D software rasterizer. f) FreeType - bitmap and vector font rendering. g) SQLite - a powerful and lightweight relational database engine available to all applications. 4.7 Security Issues Android mobile phone platform is going to be more secure than Apple’s iPhone or any other device in the long run. There are several solutions nowadays to protect Google phone from various attacks. One of them is security vendor McAfee, a member of Linux Mobile (LiMo) Foundation. This foundation joins particular companies to develop an open mobile-device software platform. Many of the companies listed in the LiMo Foundation have also become members of the Open Handset Alliance (OHA). However, open platform has its own disadvantages, such as source code vulnerability for black-hat hackers. In parallel with great opportunities for mobile application developers, there is an expectation for exploitation and harm. Stealthy Trojans hidden in animated images, particular viruses passed from friend to friend, used for spying and identity theft, all these threats will be active for a long run. Another solution for such attacks is SMobile Systems mobile package. SecurityShield integrated application that includes anti-virus, anti-spam, firewall and other mobile protection is up and ready to run on the Android operating system. Currently, the main problem is availability for viruses to pose as an application and do things like dial phone numbers, send text messages or multi-media messages or make connections to the Internet during normal device use. Hence SMobile Systems is ready to notify and block these secure alerts. But the truth is that it is not possible to secure your mobile device or personal computer completely, as it connects to the internet.
  • 21. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 21 Chapter - 5 Comparison 5.1 Speculations with Cellular Carriers Google Android enters a tangled mess of cellular carrier world. As a new player in the mobile market, Android brings an open platform with the new rules. On the one hand there is OHA with major companies and carries, such as T-Mobile and Sprint. On the other hand, there are two largest cellular carries AT&T and Verizon Wireless in United States, which have a vested interest in operating systems of their own. It is predictable, that Sprint or T-Mobile will be first carriers providing devices with Google Android. This ensures equal development time for the networks, GSM side and CDMA.But the main problem, which faces all the cellular carriers around the world, is the availability to download and use free applications that could block almost every communications product they sell. A user does not need to pay for GPS mapping service anymore. He can simply download a free one that taps into Google Maps. In fact,why pay for cellular minutes at all when a user can download Skype, Gtalk or other client and just use his data plan OS such as Android threaten carriers with a loss of control over the applications on the phones on their network and they may find themselves becoming nothing more than wireless Internet service providers, forced to compete on price and bandwidth. Another aspect is hardware cost: Google Android owns 10 percent of the total cost of a phone, which combined with falling hardware prices could eventually result a fertile unlocked handset market. In conclusion, Google has a better start in this race than any company had before to bring new rules to the mobile market with all carriers, mobile devices and its customers. 5.2 Manufacturers War Presently, Google main competitors like Nokia, Microsoft and Apple do not see Google Android as a serious rival or threat to their business strategies. However, the
  • 22. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 22 current situation is not so unsophisticated. There is a huge flurry in the companies, which are not in the list of OHA. For instance, Nokia, which is the largest handset manufacturer in the world, nowadays owning some 39% market share, was one of the companies snubbed on the invitation list to the 34-party Open Handset Alliance that is growing daily. In contrast, Nokia is buying companies and dumping cash into development, while Google is releasing an open platform hoping the applications and services will build themselves with the help of a strong developer community, development contests and large alliance of grand companies. Despite of this, Nokia is ready to combat whatever Google has to throw with Google Android in 2008. Another company Apple has already stroked the market with iPhone and its closed operating system. Accordingly, iPhone in the US remains loyal to AT&T mobile carrier for five years. That is plenty of time for Google to conquer the market with open Android.Obvious advantage of Android is cost: while iPhone is priced at a weighty $400, Google says it hopes to reach a more mainstream market by pricing Android- powered devices at around $200. Microsoft, selling 21 million copies of Windows Mobile software, stays calm at this point, waiting for some particular results from Google Android. This nice and healthy competition is just what the mobile industry needs at the moment,at least for the consumers. The wars being waged between Google and the field will onlycreate better, cheaper handsets and more advanced applications. 5.3 Market Research A new generation of mobile device users is coming in the next decade. These users are going to explore the mobile internet afresh with its new features, compatible mobile phones, new services and applications. This is a huge leap for mobile advertisement business, where revenue could rise 8 times more by 2012. Google Android is going to present new solutions through the fast search engine, open source applications and other services. The Kelsey Group, which works with public opinion polls and statistics, published the results released October 11 2007, which say, that one hundred out of 500, or 20
  • 23. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 23 percent of people would be interested in purchasing a Google phone. Despite the fact, that Google Android is in alpha version and it is unknown for the customers and mobile market, the results look promising. People do not find a good Internet experience in their phones today, so they are more interested in gravitating toward an Internet or technology company telephone because they think connectivity between devices and to the Internet is going to be much better on those phones. They use Google search, GMail, Google Maps, Picasa albums and other popular services on their computers, and this is what they expect to have in their mobile devices in the close future. 5.4 Mobile Ads Jaiku - an activity stream and sharing service that works from the Web and mobile phones was bought by Google as important investment into the mobile advertisement.People wondered why Google preferred the micro-blogging service to Twitter, which is much more popular nowadays. The answer lies in Jaiku unique ability to combine micro-blogging with users location. An integral part of the service is a Jaiku client application for Symbian S60 platform mobile phones, which should come to Android platform as well. The client uses location APIs within device to get the handset and the user’s location based on nearby cellular network towers. Though the location is not very precise, the mobile phone is able to broadcast it automatically. At that point the text can be connected to users location and create a list of preferences for each place the user frequently visits. Using such a technology, it is simple to track down a user via phone IP address, whenever he comes into McDonald or is sitting in the airport.Google is not a million miles away from being able to push advanced advertising to individuals based on their profile, their location and their availability. They already offer regional and local targeting for ads for desktop users, but this could be much more useful for a mobile phone. And if the ads are truly relevant, interesting and unobtrusive, people might actually start to like them.
  • 24. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 24 5.5 Mobile Services Adding to its fast growing suite of mobile applications and services, Google has applied for a patent for a mobile payments service that would allow users to make payments at retail shops using their mobile phones. The Text Message Payment patent describes a system where Google offers mobile focused payments called GPay. This describes a system where a SMS message would be sent containing a payment amount and other information. That payment amount would then be validated, debited from the user's account, and communicated from server to server. Described as "a computer-implemented method of effectuating an electronic on- line payment," the system mentioned in the patent application is similar to existing mobile payment services. These services like mobile version of PayPal have been available for some time but have had little success bursting with merchants and with customers. The main difference between existing mobile payment systems and GPay is, of course, that GPay is created by Google and will be easily adopted by Android Platform. The more issues regarding Gpay are yet to be released. 5.6 What Makes Android Special There are already many mobile platforms on the market today, including Symbian, iPhone, Windows Mobile, BlackBerry, Java Mobile Edition, Linux Mobile (LiMo), and more. While some of its features have appeared before, Android is the best environment that combines: a) A truly open, free development platform based on Linux and open source. Handset makers like it because they can use and customize the platform without paying a royalty. Developers like it because they know that the platform has legs and is not locked into any one vendor that may go under or be acquired. b) A component-based architecture inspired by Internet mash-ups. Partsof one application can be used in another in ways not originallyenvisioned by the
  • 25. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 25 developer. You can even replace built-in components with your own improved versions. This will unleash a new round of creativity in the mobile space. c) Tons of built-in services out of the box. Location based services use GPS or cell tower triangulation to let you customize the user experience depending on where they are. A full-powered SQL database lets you harness the power of local storage for occasionally connected computing and synchronization. Browser and Map views can be embedded directly in your applications. All these built-in capabilities help to raise the bar on functionality while loweringyour development costs. d) Automatic management of the application life cycle. Programs are isolated from each other by multiple layers of security, which will provide a level of system stability not seen before in smart phones.The end user will no longer have to worry about what applications are active, or close some programs so that others can run. Android is optimized for low-power, low-memory devices in a fundamental way that no previous platform has attempted. e) High quality graphics and sound. Smooth, anti-aliased 2D vector graphics and animation inspired by Flash is melded with 3D accelerated OpenGL graphics to enable new kinds of games and business applications. Codec for the most common industry standard audio and video formats are built right in, including H.264 (AVC), MP3, and AAC. f) Portability across a wide range of current and future hardware.All your programs are written in Java and executed by Android’s Dalvik virtual machine so your code will be portable across ARM,x86, and other architectures. Support for a variety of input methods is included such as keyboard, touch, tilt, camera, voice, and trackball. User interfaces can be customized for any screen resolution and orientation.Android is a fresh take on the way mobile applications interact with users, along with the technical underpinnings to make it possible. But the best part of Android is the software that you are going to write for it. This book will help you get off to a great start.
  • 26. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 26 5.7 Android and Java ME Java Platform, Micro Edition or Java ME (previously known as Java 2 Platform, Micro Edition or J2ME) is a specification of a subset of the Java platform aimed at providing a certified collection of Java APIs for the development of software for small, resource-constrained devices. Though, do not confuse it with Google Android, even there are some similarities: a) Eclipse plug-ins for J2ME and Android look very similar and interface very well with their respective SDKs; b) Both J2ME and Android seem to share the same core Java APIs, such as java.util and java.net. But their APIs for graphics, UIs, etc. are very dissimilar and philosophies for developing applications are very different; c) Android seems to be more tightly integrated (up to even the OS services provided and how they interact with the APIs), while J2ME is far more liberal in its specifications for the developer and mobile device manufacturer. A slower application development and performance, these are the main disadvantages Java's J2ME have for today. J2ME apps are second-rate citizens in the phones. They do not have an access to most of the low-level features, like call API, external connectivity (USB) and other. There is no way to replace or extend built-in phone apps like contacts, calendar and calls. 5.8 Openness of the Platform The open source school of thought implies that differentiation and competitive advantage come from innovation on top of the underlying platform rather than the platform itself. The robustness and scalability of the platform is secured by the community’s stewardship, and open access to a central repository of updated code. Beyond this, a strong third-party development environment and software development kit (SDK) are critical to attracting innovation.
  • 27. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 27 Open is an invariably subjective term. Symbian and Microsoft can claim a degree of openness for their mobile platforms, for example, but ultimate control of API access and source code remains with a single entity. On the contrary, as Google has pointed out, there’s nothing keeping any of the alliance members from using Android to build a Yahoo! Go phone. Importantly, Android includes almost the entirety of the applications-related software stack, less key technical pieces such as telephony protocol stacks, which are left to silicon vendors. Android bundles critical components such as a Linux kernel from Wind River, various optimized graphics engines, codecs, notification software, a clean room JVM implementation, and the KHTML open source browser. The latter forms the basis of Apple’s Safari and Nokia’s S60 offerings. 5.9 Advantages a) Open - Android allows you to access core mobile device functionality through standard API calls. b) All Applications are Equal - Android does not differentiate between the phone's basic and third-party applications -- even the dialer or home screen can be replaced. c) Breaking Down Boundaries - Combine information from the web with data on the phone -- such as contacts or geographic location -- to create new user experiences. d) Fast And Easy Development - The SDK contains what you need to build and run Android applications, including a true device emulator and advanced debugging tools. 5.10 Disadvantages a) Security - Making source code available to everyone inevitably invites the attention of black hat hackers.
  • 28. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 28 b) Open Source - A disadvantage of open-source development is that anyone can scrutinize the source code to find vulnerabilities and write exploits. c) Login - Platform doesn't run on an encrypted file system and has a vulnerable log- in. d) Incompetence - Google dependence on hardware and carrier partners puts the final product out of their control.
  • 29. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 29 Chapter - 6 Project Plan and Timeline 6.1 ProjectPlan SensActions has been in development since August, 2013 and the final release of the project was inApril, 2014 and we further plan to improve the project to improve upon user experience and to increase the user satisfaction level with our application. As the project is already in the public domain, i.e. it is available on the Google Play Store, it open to user scrutiny. We encourage all the healthy criticism provided by the users of our application which help us to bring further improvements in the app. As the android platform is used on a diverse number devices provided by different vendors with different hardware specifications and as our application relies heavily on the hardware some problems are bound to crop up. We try to solve such problems as and when they are reported by the users of our application. Spanning a period of 7 months the project encompasses a large number of modules, algorithms, java classes and XML code utilizing the mobile device’s hardware and software. The summary of the project’s development and download stats till 15 November, 2013 is depicted through the following graph and chart:
  • 30. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 30 Fig 6.1: Download Stats for SensActions First public release on Google Play store: 12-08-2013 First download on: 13-08-2013 Download count: Approx. 1550 and still counting
  • 31. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 31 6.2 Timeline The summary of the project’s development and its timeline can be depicted through the following diagram: 05-08-2013 Development work started 11-08-2013 SensLock module completed 12-08-2013 SensLock published on Play Store 28-08-2013 Development on other modules started 12-09-2013 SensMusicmodule completed 26-09-2013 SensCall module completed 10-10-2013 First update to the app released (new features) 16-10-2013 SensTorch module completed
  • 32. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 32 Fig 6.2: Flowchart Showing the Lifecycle of SensActions 08-12-2013 Secondupdate to the app released (new features & bug fixes) 21-01-2014 Solved compatibility issues with some Android devices 07-02-2014 Updated the app’s User Interface 03-03-2013 Started work on the Documentation 23-03-2014 Implement Morse code functionality in SensTorch 02-04-2014 Implement SensSteps module 17-04-2014 Complete the documentation and user manual 25-04-2014 Final Application
  • 33. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 33 Chapter - 7 Software Specification and Requirements 7.1 Overview Platform:-Android Supported android versions:- 2.2 - 4.4.x Number ofsupporteddevices:- 3981 models Programming languages used:- JAVA and XML IDE used:- Eclipse Indigo Source code size:- Approx. 4.3mb Final application size:- Approx. 700kb Application extension:- .apk (Application Package) 7.2 Requirements 7.2.1 Software Requirements Platform:- Android Android version: - 2.2 and above Screen Size: - All types of screen sizes are supported RAM:- Depends upon enabled actions (3 MB to10 MB)
  • 34. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 34 7.2.2 Hardware Requirements At least one of them:- * Proximity Sensor * Accelerometer Sensor * Front Camera * Microphone (Present in all devices) * Camera Flashlight
  • 35. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 35 Chapter - 8 Organization Chart for Different Modules SensLock SensTorch SensMusic SensCall Fig 8.1: Componentsof SensActions
  • 36. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 36 8.1 SensLock: Start Service Check for ProximitySensor Not Found Stop Found (Get values) If greater than Maximum Range Sensor is open or not in cover (Lock the device) Else Sensor is closed or in cover (Unlock the device)
  • 37. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 37 8.2 SensMusic: Start Service Check for Accelerometer Sensor Not Found Stop Found (Get values in x, y, z) Check difference of previous and new value If greater than Shake threshold Shake detected (Changetrack) Else No shake
  • 38. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 38 8.3 SensCall: Call Service Check for Proximity Sensor Not Found Stop Found (Get values) If greater than Maximum Range Sensor is open or not in cover (End the call) Else Sensor is closed or in cover (Answer the call) Shake Service Start Service Check for Accelerometer Sensor Not Found Stop Found (Get values in x, y, z) Check difference of previous and new value If greater than Shake threshold Shake detected (Mute ringer) Else No shake
  • 39. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 39 8.4SensTorch: On Start Check for Camera Flashlight Not Found Stop (Display message) Found (Check for Strobe) If enabled Turn On and off at selected interval Else Turn On continuously
  • 40. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 40 Chapter - 9 Modules Present 9.1 SensLock Activity First you have to activate SensLock Admin to perform any function. To do this, Tap on Activate SensLock. Enable Enable SensLock to perform lock/unlock actions by monitoring proximity sensor. It automatically locks the screen when in cover or proximity and unlocks it again when not in cover or proximity depending upon the selected gesture. To do this, Tap on Enable SensLock. Lock/Unlock Device Now, you have to Enable lock or unlock to perform actions according to your need. There are some additional settings like Quick unlock which automatically bypass the lock screen. Disable in landscape mode to avoid accidental locks while playing games or watching videos. Lock/Unlock Gestures You can select from various gestures to perform lock/unlock actions. It also has Hold timeout for which you have to hold to trigger the action. Gesture Timeout In this you can select the timeout after which the gesture will be ignored and you have to perform the gesture again. It is beneficial to avoid accidental screen unlocks when the device is in pocket or cover.
  • 41. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 41 Delay lock Lock method wakes up the screen again in Android 4.0.4 - 4.1.2. So, to avoid screen flicker, it will delay the lock screen for some time. Keep Screen On These settings will apply when your device will wake up next time via proximity sensor. Widgets It also support widgets. There are three types, one is to enable/disable action via sensor, second one is to lock the screen immediately and third one is to toggle SensLock. To add them, long press on your home screen -> Widgets -> SensLock Toggle or SensLock LockNow or SensLock Mode. LockNow Widgets It will lock the device immediately. Lock method wakes up the screen again in Android 4.0.4 - 4.1.2. So, to avoid this check Force lock again option in Settings. If your device behaves abnormally after doing this then, uncheck this option and select your system lock screen to none. 9.2 SensTorch Caution Prolonged usage of SensTorch may decrease your battery life. So, use it whenever it is necessary and switch off immediately after the usage. Strobe or SOS To turn on the strobe or SOS tap on Strobe checkbox. Again tap on Strobe to turn it off.
  • 42. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 42 Strobe Frequency You can also select strobe frequency so that torch will toggle according to the selected interval. To do this, Tap on Menu button or icon -> Settings and then, select Strobe frequency. 9.3 SensMusic Enable First you have to enable SensMusic to change your tracks by shaking the device. To enable SensMusic, Tap on Enable SensMusic. After that you can change different settings according to your need. Apply on Boot Tap on this if you want to start SensMusic service automatically when device boots up. Show Notification Tap on this if you want to enable notification when SensMusic is enabled. It will also show the selected shake action. Shake Action In this you can select shake actions which you have to perform when shake is performed. There are three actions:- Play Next - Skip to next track, Play previous – Skip to previous track, Play according to shake - It will skip the track in the direction of shake. Shake right to play next and shake left to play previous track. Shake Threshold In this you can select, how harder you have to shake the device. Higher the value, harder you have to shake. Try different values to find perfect match for your device.
  • 43. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 43 Shake Delay In this you can select the delay between two consecutive shakes to avoid skipping of multiple tracks. After first shake, you have to wait for the selected delay to perform next shake otherwise, it will be ignored. Widgets There are two widgets available. SensMusic Toggle to enable or disable SensMusic service and SensMusic Action to quickly switch between Shake actions. To use this widget first you have to enable SensMusic. 9.4 SensCall Enable First you have to enable SensCall to answer or end call using proximity sensor. To enable SensCall, Tap on Enable SensCall. After that you can change different settings according to your need. Apply on Boot Tap on this if you want to start SensCall service automatically when device boots up. Show Notification Tap on this if you want to enable notification when SensCall is enabled. It will also show the answer/end call mode (if enabled). Shake to Mute Enable this if you want to mute the incoming call ringer by shaking the device.
  • 44. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 44 Shake Threshold In this you can select, how harder you have to shake the device. Higher the value, harder you have to shake. Try different values to find perfect match for your device. Enable Answer Call Enable this to answer the call by using proximity sensor. After that you can change other answer call settings. Pocket Protection Enable this to avoid accidental call pick up when the device is in pocket or cover. After enabling this you have to perform the call answer gesture one more time. Answer Call Gesture In this you can select the different gestures to answer the call. Close to ear or in proximity:- Just bring the device close to ear and the call will be answered, Swipe/wave once:- Move your hand over the proximity sensor once to accept the call, Swipe/wave twice:- Move your hand over the proximity sensor twice to accept the call, Swipe/wave and hold:- Cover the proximity sensor and hold it for the selected timeout. Hold Timeout Select time (in seconds) for which you have to cover the proximity sensor to answer the call. Enable End Call Enable this to end the call by using proximity sensor. After that you can change other end call settings.
  • 45. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 45 Enable Call Gesture In this you can select the different gestures to end the call. Away from ear or not in proximity:- Just take the device away from ear and the call will be ended, Away and Swipe/wave once:- Take the device away from ear and then, move your hand over the proximity sensor once to end the call, Away and Swipe/wave twice:- Take the device away from ear and then, move your hand over the proximity sensor twice to end the call, Away from ear and hold:- Take the device away from ear and call will be ended after the selected timeout. Hold Timeout Select time (in seconds) for which you have to hold the device away from ear to end the call. Widgets There are two widgets available. SensCall Toggle to enable or disable SensCall service and SensCall Mode to quickly switch between modes:-Answer/end call, Answer call, End call. To use this widget first you have to enable SensCall.
  • 46. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 46 Chapter -10 Source Code Java and XML programming languages are extensively used while programming an Android application. Same is the case with SensActions which uses Java and XML to code the working logic and the user interface of the application.  Java is the main programming language which is used to code the working logic and the background operating functions of this application.  XML have been used to design the beautiful and attractive user interface which provides a consistent elegant feel to the entire application.  Adobe Photoshop have been used to create various images and icons present in the application. 10.1 Java Code 10.1.1 Main Menu import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; public class SensActions extends ActionBarActivity{ private Button lock, torch, music, call, help, about, unins; private TextView en_actions, no_item;
  • 47. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 47 private ImageView im_lock, im_call, im_music; private LinearLayout firstRow, secondRow, thirdRow; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sens_actions_main); lock = (Button) findViewById(R.id.btnSensLock); torch = (Button) findViewById(R.id.btnSensTorch); music = (Button) findViewById(R.id.btnSensMusic); call = (Button) findViewById(R.id.btnSensCall); help = (Button) findViewById(R.id.btnHelp); about = (Button) findViewById(R.id.btnAbout); unins = (Button) findViewById(R.id.btnUninstall); en_actions = (TextView) findViewById(R.id.textEnActions); lock.setOnClickListener (new OnClickListener() { public void onClick(View v) { startAction(SensActions.this, SensLock.class); } }); lock.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { showVisibleItems(); return true; } }); torch.setOnClickListener (new OnClickListener() { public void onClick(View v) {
  • 48. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 48 startAction(SensActions.this, SensTorch.class); } }); torch.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { showVisibleItems(); return true; } }); music.setOnClickListener (new OnClickListener() { public void onClick(View v) { startAction(SensActions.this, SensMusic.class); } }); music.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { showVisibleItems(); return true; } }); call.setOnClickListener (new OnClickListener() { public void onClick(View v) { startAction(SensActions.this, SensCall.class); } }); call.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) {
  • 49. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 49 showVisibleItems(); return true; } }); Toast.makeText(SensActions.this, R.string.welcome_text, Toast.LENGTH_LONG).show(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.disclaimer) .setMessage(R.string.disclaimer_content) .setCancelable(false) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { SensLock.stopService(SensActions.this, SensLockService.class); SensLock.stopService(SensActions.this, SensMusicService.class); dialog.dismiss(); Intent help = new Intent(getBaseContext(), SensActionsHelp.class); startActivity(help); Toast.makeText(SensActions.this, R.string.welcome_help_text, Toast.LENGTH_LONG).show(); } }); AlertDialog alert = builder.create(); alert.show(); } }
  • 50. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 50 10.1.2 SensLock import android.app.admin.DeviceAdminReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.widget.Toast; public class SensLockAdmin extends DeviceAdminReceiver{ static SharedPreferences getSamplePreferences(Context context) { return context.getSharedPreferences( DeviceAdminReceiver.class.getName(), 0); } @Override public void onEnabled(Context context, Intent intent) { Toast.makeText(context, R.string.admin_activate, Toast.LENGTH_SHORT).show(); if(SensLock.loadPrefs(context, "prefEnableSensLock", false)) { SensLock.startService(context, SensLockService.class); } if(SensLock.loadPrefs(context, "prefShowNotify", false)) { SensLock.startService(context, NotificationService.class); } SensLock.startService(context, UpdateWidgetService.class); if(SensLock.loadPrefs(context, "IsFirstLock", true)) { SensLock.savePrefs(context, "IsFirstLock", false); Toast.makeText(context, R.string.welcome_enable_text, Toast.LENGTH_LONG).show(); } } @Override public void onDisabled(Context context, Intent intent) { Toast.makeText(context, R.string.admin_deactivate, Toast.LENGTH_SHORT).show(); SensLock.stopService(context, SensLockService.class); SensLock.startService(context, NotificationService.class); SensLock.startService(context, UpdateWidgetService.class); }
  • 51. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 51 10.1.3 SensCall import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceActivity; import android.view.View; import android.view.View.OnClickListener; import android.widget.CheckBox; import android.widget.LinearLayout; import android.widget.Toast; public class SensCall extends PreferenceActivity implements OnSharedPreferenceChangeListener{ CheckBox enable, boot, notify; CheckBoxPreference pref_enable, pref_notify, ans, end; ListPreference answerGesture, endGesture; SeekBarPreference timeOut, timeOutEnd; @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.sens_call); SensLock.savePrefs(SensCall.this, "bootController", true); enable = (CheckBox) findViewById(R.id.enableCall); boot = (CheckBox) findViewById(R.id.bootCall); notify = (CheckBox) findViewById(R.id.notifyCall); pref_enable = (CheckBoxPreference) findPreference("prefEnableCall"); pref_notify = (CheckBoxPreference) findPreference("prefShowNotifyCall"); timeOut = (SeekBarPreference) findPreference("prefAnswerTimeout"); timeOutEnd = (SeekBarPreference) findPreference("prefEndTimeout"); ans = (CheckBoxPreference) findPreference("prefAnswerCall"); end = (CheckBoxPreference) findPreference("prefEndCall"); answerGesture = (ListPreference) findPreference("prefAnswerGesture"); String currentValue = answerGesture.getValue(); endGesture = (ListPreference) findPreference("prefEndGesture"); String currentValueEnd = endGesture.getValue(); if (currentValue == null) {
  • 52. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 52 answerGesture.setValue((String)answerGesture.getEntryValues()[R.array.ans werGestureValues]); currentValue = answerGesture.getValue(); } updateActionSummary(currentValue); if (currentValueEnd == null) { endGesture.setValue((String)endGesture.getEntryValues()[R.array.endGesture Values]); currentValueEnd = endGesture.getValue(); } updateActionEndSummary(currentValueEnd); answerGesture.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { updateActionSummary(newValue.toString()); return true; } }); endGesture.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { updateActionEndSummary(newValue.toString()); return true; } }); pref_enable.setOnPreferenceChangeListener (new OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { if(SensLock.loadPrefs(SensCall.this, "IsFirstCall", true)) { SensLock.savePrefs(SensCall.this, "IsFirstCall", false); } if((Boolean) newValue)
  • 53. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 53 { pref_enable.setTitle(R.string.pref_disable_call); pref_enable.setSummary(R.string.pref_disable_call_summary); } else { pref_enable.setTitle(R.string.pref_enable_call); pref_enable.setSummary(R.string.pref_enable_call_summary); } SensLock.startService(SensCall.this, CallNotificationService.class); SensLock.startService(SensCall.this, UpdateWidgetService.class); return true; } }); } } 10.1.4 SensTorch import android.app.Service; import android.content.Intent; import android.hardware.Camera; import android.hardware.Camera.Parameters; import android.os.Handler; import android.os.IBinder; import android.util.Log; public class SensTorchService extends Service{ private Camera camera = null; private Parameters params; private Boolean isOn=false, isStrobeRunning=false, isAutoOffRunning=false;; private Handler mHandler = new Handler(); private Handler offHandler = new Handler(); @Override public int onStartCommand(Intent intent, int flags, int startId) { getCamera(); btnOnLogic();
  • 54. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 54 return(START_NOT_STICKY); } private Runnable startStrobe = new Runnable() { public void run() { if(isOn) { flashLightOff(); } else { flashLightOn(); } mHandler.postDelayed(this, SensLock.loadPrefs(SensTorchService.this, "prefDelayTime", 5)*100); } }; private Runnable startAutoOff = new Runnable() { public void run() { torchOffLogic(); } }; private void getCamera() { if (camera == null) { try { camera = Camera.open(); params = camera.getParameters(); } catch (RuntimeException e) { Log.e("Camera Error. Failed to Open. Error: ", e.getMessage()); } } } private void btnOffLogic() { torchOffLogic(); if(isAutoOffRunning) { offHandler.removeCallbacks(startAutoOff); isAutoOffRunning=false; } }
  • 55. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 55 private void btnOnLogic() { torchOnLogic(); if(SensLock.loadPrefs(SensTorchService.this, "IsAutoOff", false)) { offHandler.postDelayed(startAutoOff, SensLock.loadPrefs(SensTorchService.this, "prefAutoOffTime", 1)*60000); isAutoOffRunning=true; } } 10.1.5 SensMusic import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.widget.Toast; public class SensMusicWidgetClickListener extends Service{ @Override public void onCreate(){ updateWidgetState(); stopSelf(); } @Override public IBinder onBind(Intent arg0) { // TODO Auto-generated method stub return null; } public void updateWidgetState() { if(SensLock.loadPrefs(SensMusicWidgetClickListener.this, "AccelerometerSensor", true)) { if(SensLock.loadPrefs(SensMusicWidgetClickListener.this, "prefEnableMusic", false)) { SensLock.stopService(SensMusicWidgetClickListener.this, SensMusicService.class); SensLock.savePrefs(SensMusicWidgetClickListener.this, "prefEnableMusic", false); } else {
  • 56. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 56 SensLock.startService(SensMusicWidgetClickListener.this, SensMusicService.class); SensLock.savePrefs(SensMusicWidgetClickListener.this, "prefEnableMusic", true); } if(SensLock.loadPrefs(SensMusicWidgetClickListener.this, "prefShowNotifyMusic", false)) { SensLock.startService(SensMusicWidgetClickListener.this, MusicNotificationService.class); } } else { SensLock.stopService(SensMusicWidgetClickListener.this, SensMusicService.class); SensLock.savePrefs(SensMusicWidgetClickListener.this, "prefEnableMusic", false); Toast.makeText(this,R.string.text_hint_no_accemtr, Toast.LENGTH_SHORT).show(); } SensLock.startService(SensMusicWidgetClickListener.this, UpdateWidgetService.class); } } 10.2 XML Coding 10.2.1 Main Menu <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <RelativeLayout android:id="@+id/SensActionsHeader" android:layout_width="fill_parent" android:layout_height="200dp" android:layout_alignParentTop="true"
  • 57. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 57 android:background="@drawable/sens_actions_banner" > <ImageView android:id="@+id/headerAppIcon" android:layout_width="40.0dip" android:layout_height="35.0dip" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="15.0dip" android:layout_marginTop="8.0dip" android:src="@drawable/ic_sens_actions" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_alignParentTop="true" android:layout_marginTop="10.0dip" android:layout_marginLeft="10.0dip" android:layout_toRightOf="@id/headerAppIcon" android:maxLines="1" android:text="@string/app_name" style="@style/LargeTitleWithShadow"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_alignParentRight="true" android:layout_marginRight="20.0dip" android:layout_alignParentBottom="true" android:layout_marginBottom="20.0dip" android:maxLines="3" android:maxWidth="230.0dip" android:text="@string/sens_tag_line" android:textColor="@color/white" android:textSize="18.0sp" /> </RelativeLayout> <RelativeLayout android:id="@+id/bottomBar" android:layout_width="fill_parent" android:layout_height="60dp" android:layout_alignParentBottom="true" android:background="@drawable/bg_bottom" > <TextView android:id="@+id/textEnActions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_marginLeft="20.0dip" android:layout_centerVertical="true" android:maxLines="3"
  • 58. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 58 android:maxWidth="230.0dip" android:text="@string/no_actions" android:textColor="@color/white" android:textSize="20dp" /> <HorizontalScrollView android:drawingCacheQuality="low" android:animationCache="false" android:alwaysDrawnWithCache="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginRight="10.0dip" android:layout_centerVertical="true" android:overScrollMode="never" android:layout_toRightOf="@id/textEnActions" android:scrollbars="none"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:animateLayoutChanges="true"> <ImageView android:id="@+id/enSensLock" android:layout_width="40.0dip" android:layout_height="40.0dip" android:layout_marginLeft="10.0dip" android:src="@drawable/ic_sens_lock"/> <ImageView android:id="@+id/enSensMusic" android:layout_width="40.0dip" android:layout_height="40.0dip" android:layout_marginLeft="10.0dip" android:src="@drawable/ic_sens_music"/> <ImageView android:id="@+id/enSensCall" android:layout_width="40.0dip" android:layout_height="40.0dip" android:layout_marginLeft="10.0dip" android:src="@drawable/ic_sens_call"/> </LinearLayout> </HorizontalScrollView> </RelativeLayout> 10.2.2 Help Menu <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
  • 59. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 59 <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginRight="20dp" android:layout_marginLeft="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_caution" android:textSize="28sp" android:textColor="@color/light_blue" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_caution_desc"/> <TextView android:layout_marginTop="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/menu_help" android:textSize="28sp" android:textColor="@color/light_blue" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_desc"/> <TextView android:layout_marginTop="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_apply_on_boot" android:textSize="28sp" android:textColor="@color/light_blue" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_apply_on_boot_desc"/> <TextView android:layout_marginTop="10dp" android:layout_width="wrap_content"
  • 60. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 60 android:layout_height="wrap_content" android:text="@string/help_notifi" android:textSize="28sp" android:textColor="@color/light_blue" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_notifi_desc"/> <TextView android:layout_marginTop="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_widgets" android:textSize="28sp" android:textColor="@color/light_blue" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_widgets_desc"/> <TextView android:layout_marginTop="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/pref_uninstall" android:textSize="28sp" android:textColor="@color/light_blue" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_uninstall_desc"/> </LinearLayout> </ScrollView> </RelativeLayout> 10.2.3 About <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" >
  • 61. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 61 <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" <ImageView android:id="@+id/SensLock" android:contentDescription="@string/sens_lock_banner" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:src="@drawable/sens_actions" > </ImageView> <TextView android:id="@+id/txtVersion" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/sens_lock_version" android:textSize="16sp" android:layout_gravity="center" android:textStyle="bold" /> <View android:id="@+id/divider" android:layout_width="fill_parent" android:layout_height="4dp" android:layout_marginTop="20dp" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:background="@drawable/divider_horizontal_dark_opaque"/> <TextView android:id="@+id/txtSensLock" android:layout_width="wrap_content"
  • 62. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 62 android:layout_height="wrap_content" android:layout_marginTop="20dp" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:text="@string/sens_lock_summary" android:textSize="17sp" android:layout_gravity="center"/> <TextView android:id="@+id/txtReview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:text="@string/sens_review_summary" android:textSize="17sp" android:layout_gravity="center"/> <TextView android:id="@+id/txtRate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:layout_marginBottom="20dp" android:text="@string/sens_rate_summary" android:textSize="20sp" android:textStyle="bold" android:textColor="@color/light_blue" android:layout_gravity="center"/> </LinearLayout> </ScrollView>
  • 63. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 63 10.2.4 Widget and Animator <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginRight="20dp" android:layout_marginLeft="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_caution" android:textSize="28sp" android:textColor="@color/light_blue" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_torch_caution_desc"/> <TextView android:layout_marginTop="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content"
  • 64. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 64 android:text="@string/help_torch_strobe" android:textSize="28sp" android:textColor="@color/light_blue" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_torch_strobe_desc"/> <TextView android:layout_marginTop="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_torch_strobe_freq" android:textSize="28sp" android:textColor="@color/light_blue" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/help_torch_strobe_freq_desc"/> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="35dp" android:background="@drawable/lock_disabled" android:id="@+id/torch_bg"> <Button android:id="@+id/btnTorchEnable"
  • 65. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 65 android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/btn_sens_torch" android:layout_centerHorizontal="true" android:layout_centerVertical="true"/> </RelativeLayout> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="25dp" android:text="@string/torch_help_text" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="@color/light_blue" android:textSize="20dp" android:textStyle="bold" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="40dp" android:layout_marginTop="55dp" android:src="@drawable/sens_torch_help" /> </RelativeLayout> 10.2.5 Sliding Tabs <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  • 66. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 66 xmlns:pranavpandey="http://schemas.android.com/apk/res/com.pranavpandey.sen slock" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <com.pranavpandey.senslock.SlidingTabs android:id="@+id/slidingtabs" android:layout_width="fill_parent" android:layout_height="wrap_content" pranavpandey:bottomBarColor="#ff96aa39" pranavpandey:bottomBarHeight="2dip" pranavpandey:tabIndicatorHeight="3dip" android:background="#ff3b3b3b"/> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="fill_parent" android:layout_height="0px" android:layout_weight="1" /> <LinearLayout android:id="@+id/help_button_bar" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:id="@+id/help_button_ok" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/ok" /> </LinearLayout> </LinearLayout>
  • 67. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 67 Chapter - 11 Snapshots 11.1 Main Application Menu Fig 11.1:With no actionsenabled Fig 11.2:With three actions enabled
  • 68. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 68 11.2 Supported Actions Fig 11.3:Action for SensCall Fig 11.4:Action for SensMusic Fig 11.5:Action for SensLock Fig 11.6:Action for SensTorch
  • 69. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 69 11.3 Modules Fig 11.7: SensCall Fig 11.8: SensMusic Fig 11.9: SensLock Fig 11.10: SensTorch
  • 70. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 70 11.4 Help and About Fig 11.11:SensCall Help Fig 11.12:SensMusic Help Fig 11.13:SensTorch Help Fig 11.14:SensLock Help
  • 71. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 71 Fig 11.15:SensActionsHelp Fig 11.16:About SensActions
  • 72. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 72 11.5 SensActions Widgets Fig 11.17:WidgetsActivated Fig 11.18:Widgets Deactivated
  • 73. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 73 Chapter - 12 Testing and Maintenance 12.1 Testing The completion of a system is achieved only after it has been thoroughly tested. Though this gives a feel the project is completed, there cannot be any project without going through this stage. Though the programmer may have taken many precautions not to commit any mistakes that crop up during the execution stage. Hence in this stage it is decided whether the project can undergo the real time environment execution without any break downs, therefore a package can be rejected even at this stage. The testing phase involves the testing of the developed system using various kinds of data. An elaborated testing of data is prepared and a system is tested using the test data. While testing, errors are noted and corrections remade, the corrections are also noted for future use. Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs (errors or other defects). Software testing can be stated as the process of validating and verifying that a computer program/application/product: Meets the requirements that guided its design and development, works as expected, can be implemented with the same characteristics, and satisfies the needs of stakeholders. 12.1.1 Visual Testing The aim of visual testing is to provide developers with the ability to examine what was happening at the point of software failure by presenting the data in such a way
  • 74. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 74 that the developer can easily find the information he requires, and the information is expressed clearly.At the core of visual testing is the idea that showing someone a problem (or a test failure), rather than just describing it, greatly increases clarity and understanding. Visual testing therefore requires the recording of the entire test process – capturing everything that occurs on the test system in video format. Output videos are supplemented by real-time tester input via picture-in-a-picture webcam and audio commentary from microphones. Visual testing provides a number of advantages. The quality of communication is increased dramatically because testers can show the problem (and the events leading up to it) to the developer as opposed to just describing it and the need to replicate test failures will cease to exist in many cases. The developer will have all the evidence he requires of a test failure and can instead focus on the cause of the fault and how it should be fixed. 12.1.2 Acceptance Testing Tested SensActions on different devices and versions of Android. We have used devices from different manufacturers:  Sony (Ericsson)  LG  Samsung  Micromax  Xolo  Motorola We have also tested it on the different versions of android:  2.3.x (Gingerbread)  4.0.x (Ice-cream Sandwich)  4.1.x - 4.3.x (Jelly Bean)  4.4.x (KitKat) 12.2 Maintenance Once the software is delivered and developed, it enters the maintenance phase. After implementation systems need maintenance. Beyond monkey testing during
  • 75. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 75 Software development some errors may not appear. During its usage by the end-user with actual data certain errors may disclose. Therefore some residual errors or bugs remain in the system that must be removed as they are discovered. Many of these surfaces only after the system have been in operation sometimes for a long time. These errors once discovered need to be removed on an urgent basis for the smooth running of the system, leading to the software getting hanged. Though Maintenance is not a part of software development, it is an extremely important activity in the life of a software product. Maintenance involves understanding the existing software (code and related documents), understanding the effects of change, making the changes-to both the code and documents-testing the new parts and retesting the old part. For successful and smooth running of the system, maintenance is the prominent part of the project. Any error, which hinders the functioning of any part of the project, may lead to bad impression of the developer. There are majorly two types of errors: Compilation error and Runtime errors. Compilation errors are errors during coding and are to be taken care of by the developer during development process. Runtime errors are those which occurs during running of the program. Whenever there is an occurrence of error an ‘Error Window’ opens in the middle of the screen displaying the type of error, Error Number and the Nearest Possible reason as to why the error has occurred. With the occurrence of this Error Window the operator (End-user) should note the type of error, the error number and the description of the error and should immediately report to the concerned Developer or Administrator. Now is the role of the Maintenance Personals. After knowing the entire details from the end-user like where or at which screen does this error occurred or what type of data was fed by the user or the point of malfunctioning. Considering this error as the main reason for the malfunctioning the programmer now re-examines all the possible factors, which act behind the particular screen where error has occurred. After debugging the required error the programmer itself tests the same screen or process with dummy data. Only after getting completely satisfied with problem rectification the programmer compiles and runs the program.
  • 76. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 76 Chapter -13 Conclusion and Future Scope 13.1 Conclusion SensActions have been developed to satisfy the user’s changing need to communicate and interact with his/her device in a better way. SensActions extensively uses the hardware features provided with modern computing devices and leverages the power of almost all of the sensors provided on the smartphones and gives the user to interact with the device with the help of familiar gestures which prove to be more intuitive in nature for human beings. SensActions implements the concept of next generation smartphones. It can act as a substitute for hardware keys present on the mobile as we can use gestures in place of the keys, hence preventing their degradation. It essentially fills the gap between flagship and mid-range or older devices as now even the older devices can use gesture based features provided with the latest and high end devices. Using SensActions on a smartphone gives a convenient way for visually disabled or people with poor vision to operate the latest touch screen devices. SensActions provides the best way to protect hardware keys and sometimes it can also be used for entertainment purposes. 13.2 Future Scope:- With further improvements in the hardware and the number of accurate and high quality sensors provided with mobile devices SensActions can further be developed to encapsulate many other features which will come with advancement in the technology like: * Reading the room temperature levels * Measuring the calorie count in the body *Measuring the pulse rate of a patient.
  • 77. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 77 * With advancement in x-ray technology it can be used to take inner body x-rays. * It will be very helpful to develop button-less operations in the future. * Can be extended to recognise facial gestures. * Measuring the atmospheric pressure around the device. * Measuring the ground level height. * Can be used as metal detector. * Can be used to measure the magnetic field and emf produced in a conductor. * Gestures can also be used to sync and control other electronic devices.
  • 78. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 78 Bibliography [1]. Java Complete Reference …...………………………… Herbert Shildt [2]. Beginning Android ………………………………........... Wei-Meng Lee [3]. Professional Android App Development ………. Reto Meier [4]. Hello, Android ……………………………………………… Ed Burnette
  • 79. SensActions 2014 Department of ComputerScience & Engineering Ideal Institute of Technology,Ghaziabad 79 References [1].Android Official Webpage http://www.android.com [2]. Official Android Google Code Webpage http://code.google.com/android/ [3]. Open Handset Alliance Webpage http://www.openhandsetalliance.com/ [4]. Android Wiki http://www.androidwiki.com [5]. Official Google Blog http://googleblog.blogspot.com/ [6]. Wikipedia Information http://en.wikipedia.org/wiki/Android http://en.wikipedia.org/wiki/SQLite http://en.wikipedia.org/wiki/WebKit http://en.wikipedia.org/wiki/Eclipse