0% found this document useful (0 votes)
28 views22 pages

Mad Unit 4-1

The document provides an overview of mobile operating systems, focusing on Android and iOS, including their architectures, features, and application categories. It details the layers of both operating systems, highlighting the components that facilitate application development and user interaction. Additionally, it discusses the history of Android and the advantages and disadvantages of iOS, as well as the architecture of Android applications.

Uploaded by

arunajeon.7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views22 pages

Mad Unit 4-1

The document provides an overview of mobile operating systems, focusing on Android and iOS, including their architectures, features, and application categories. It details the layers of both operating systems, highlighting the components that facilitate application development and user interaction. Additionally, it discusses the history of Android and the advantages and disadvantages of iOS, as well as the architecture of Android applications.

Uploaded by

arunajeon.7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

UNIT IV

MOBILE OS: ANDROID, IOS - ANDROID APPLICATION ARCHITECTURE - ANDROID BASIC


COMPONENETS - INTENTS AND SERVICES - STORING AND RETRIEVING DATA
- PACKAGING AND DEPLOYMENT - SECURITY AND HACKING.

Operating System:
The Operating System is a base infrastructure software component of a computerized system. It is a interface
between the hardware and software. It controls all basic operations of the computer (or other electronic devices such
as PDA, smart phone, etc.). The Operating System allows the user to install and execute third-party applications
(commonly called apps for short), usually adding new functionality to the device.
The most popular OS's for mobile devices (smart phones and tablets) are Apple's iOS and
Google's Android and they are the only ones.

MOBILE OS
• The operating systems that control the mobile device is called mobile OS.
• A mobile operating system is an operating system that helps to run other application software on mobile
devices.
• The operating found smart include Symbian iPhone OS, RIM's
BlackBerry, Windows Mobile, Palm WebOS, Android, and Maemo. Android, WebOS, and Maemo are all
derived from Linux.
• The iPhone OS originated from BSD and NeXTSTEP, which are related to UNIX.
• It combines the beauty of computer and hand use devices. It typically contains a cellular built-in modem and
SIM tray for telephony and internet connections.

Layers of operating system

POPULAR PLATFORMS OF THE MOBILE OS:


1. Android OS: The Android operating system is the most popular operating system today. It is a mobile OS based
on the Linux Kernel and open-source software. The android operating system was developed by Google. The first
Android device was launched in 2008.
2. Bada (Samsung Electronics): Bada is a Samsung mobile operating system that was launched in 2010. The
Samsung wave was the first mobile to use the bada operating system. The bada operating system offers many mobile
features, such as 3-D graphics, application installation, and multipoint- touch.
3. BlackBerry OS: The BlackBerry operating system is a mobile operating system developed by Research
In Motion (RIM). This operating system was designed specifically for BlackBerry handheld devices. This operating
system is beneficial for the corporate users because it provides synchronization with Microsoft Exchange, Novell
GroupWise email, Lotus Domino, and other business software when used with the BlackBerry Enterprise Server.
4. iPhone OS / iOS: The iOS was developed by the Apple inc for the use on its device. The iOS operating system is
the most popular operating system today. It is a very secure operating system. The iOS operating system is not
available for any other mobiles.
5. Symbian OS: Symbian operating system is a mobile operating system that provides a high-level of integration
with communication. The Symbian operating system is based on the java language. It combines middleware of
wireless communications and personal information management (PIM) functionality. The Symbian operating system
was developed by Symbian Ltd in 1998 for the use of mobile phones. Nokia was the first company to release
Symbian OS on its mobile phone at that time.
6. Windows Mobile OS: The window mobile OS is a mobile operating system that was developed by
Microsoft. It was designed for the pocket PCs and smart mobiles.
7. Harmony OS: The harmony operating system is the latest mobile operating system that was developed by
Huawei for the use of its devices. It is designed primarily for IoT devices.
8. Palm OS: The palm operating system is a mobile operating system that was developed by Palm Ltd for use
on personal digital assistants (PADs). It was introduced in 1996. Palm OS is also known as the Garnet OS.
9. WebOS (Palm/HP): The WebOS is a mobile operating system that was developed by Palm. It based on the Linux
Kernel. The HP uses this operating system in its mobile and touchpads.

ANDROID OS
• Android is an operating system. That is, it’s software that connects hardware to software
and provides general services.
• Android is an open source operating system produced by the Open Handset Alliance (OHA). Java
language is mainly used to write the android code even though other languages can be used.
• The goal of android project is to create a successful real-world product that improves the mobile experience
for end users.
• It's a consortium of 84 companies such as google, samsung, AKM, synaptics, KDDI, Garmin,
Teleca, Ebay, Intel etc.
• It was established on 5th November, 2007, led by Google. It is committed to advance open
standards, provide services and deploy handsets using the Android Platform.

Features of Android
After learning what is android, let's see the features of android. The important features of android are given
below:
1) It is open-source.
2) Anyone can customize the Android Platform.
3) There are a lot of mobile applications that can be chosen by the consumer.
4) It provides many interesting features like weather details, opening screen, live RSS (Really Simple
Syndication) feeds etc.

Categories of Android applications


There are many android applications in the market. The top categories are:
o Entertainment
o Tools
o Communication
Productivity
o Personalization
o Music and Audio
o Social
o Media and Video
o Travel and Local etc.

HISTORY OF ANDROID
The history and versions of android are interesting to know. The code names of android ranges from A to J
currently, such as Aestro, Blender, Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, IceCream
Sandwitch, Jelly Bean, KitKat and Lollipop. Let's understand the android history in a sequence.

1) Initially, Andy Rubin founded Android Incorporation in Palo Alto, California, United States in October,
2003.
2) In 17th August 2005, Google acquired android Incorporation. Since then, it is in the subsidiary of Google
Incorporation.
3) The key employees of Android Incorporation are Andy Rubin, Rich Miner, Chris White and Nick Sears.
4) Originally intended for camera but shifted to smart phones later because of low market for camera
only.
5) Android is the nick name of Andy Rubin given by coworkers.
6) In 2007, Google announces the development of android OS.
7) In 2008, HTC launched the first android mobile.

IOS -Architecture

• mobile operating
developed by Apple Inc.
• IOS is a Mobile Operating System that was developed by Apple Inc. for iPhones,
iPads, and other Apple mobile devices.
• iOS is the second most popular and most used Mobile Operating System after Android.
• The structure of the iOS operating System is Layered based. Its communication doesn‘t
occur directly.
• The layer‘s between the Application Layer and the Hardware layer will help for Communication. The
lower level gives basic services on which all applications rely and the higher-level layers provide
graphics and interface-related services.
• Most of the system interfaces come with a special package called a framework.
• A framework is a directory that holds dynamic shared libraries like .a files, header files,
images, and helper apps that support the library. Each layer has a set of frameworks that are helpful
for developers.

CORE OS LAYER
All the IOS technologies are built under the lowest level layer i.e. Core OS layer. These technologies include:
1. Core Bluetooth Framework
2. External Accessories Framework
3. Accelerate Framework
4. Security Services Framework
5. Local Authorization Framework etc.
It supports 64 bit which enables the application to run faster
CORE SERVICES LAYER
• Some important frameworks are present in the CORE SERVICES Layer which helps the iOS
• operating system to cure itself and provide better functionality.
• It is the 2nd lowest layer in the Architecture as shown above.

1. Address Book Framework - The Address Book Framework provides access to the contact
details of the user.
2. Cloud Kit Framework - This framework provides a medium for moving data between
your app and iCloud.
3. Core Data Framework - This is the technology that is used for managing the data model of a
Model View Controller app.
4. Core Foundation Framework - This framework provides data management and service
features for iOS applications.
5. Core Location Framework - This framework helps to provide the location and heading
information to the application.
6. Core Motion Framework - All the motion-based data on the device is accessed with the help of the
Core Motion Framework.
7. Foundation Framework - Objective C covering too many of the features found in the Core
Foundation framework.
8. HealthKit Framework - This framework handles the health-related information of the user.
9. HomeKit Framework - This framework is used for talking with and controlling connected
devices with the user‘s home.
10. Social Framework - It is simply an interface that will access users’ social media accounts.
11. StoreKit Framework - This framework supports for buying of contents and services from inside
iOS apps.
MEDIA LAYER
Using the media layer, we will enable all graphics video, and audio technology of the system. This is the
second layer in the architecture. The different frameworks of MEDIA layers are:

1. ULKit Graphics - This framework provides support for designing images and animating the view
content.
2. Core Graphics Framework - This framework support 2D vector and image-based rendering ad it is a native
drawing engine for iOS.
3. Core Animation - This framework helps in optimizing the animation experience of the apps in
iOS.
4. Media Player Framework - This framework provides support for playing the playlist and enables the
user to use their iTunes library.
5. AV Kit - This framework provides various easy-to-use interfaces for video presentation, recording,
and playback of audio and video.
6. Open AL - This framework is an Industry Standard Technology for providing Audio.
7. Core Images - This framework provides advanced support for motionless images.
8. GL Kit - This framework manages advanced 2D and 3D rendering by hardware-accelerated interfaces.

COCOA TOUCH
COCOA Touch is also known as the application layer which acts as an interface for the user to work
with the iOS Operating system. It supports touch and motion events and many more features.
1. EvenKit Framework
This framework shows a standard system interface using view controllers for viewing and changing events.
2. GameKit Framework
This framework provides support for users to share their game-related data online using a Game Center.
3. MapKit Framework
This framework gives a scrollable map that one can include in your user interface of the app.
4. PushKit Framework
This framework provides registration support.

FEATURES OF IOS OPERATING SYSTEM:

1. Highly Securer than other operating systems.


2. iOS provides multitasking features like while working in one application we can switch to another application
easily.
3. iOS‘s user interface includes multiple gestures like swipe, tap, pinch, Reverse pinch.
4. iBooks, iStore, iTunes, Game Center, and Email are user-friendly.
5. It provides Safari as a default Web Browser.
6. It has a powerful API and a Camera.
7. It has deep hardware and software integration

APPLICATIONS OF IOS OPERATING SYSTEM


1. iOS Operating System is the Commercial system of Apple Inc. and is popular for
its security. Operating
2. iOS operating system comes with pre-installed apps which were developed by Apple like Mail, Map, TV,
Music, Wallet, Health, and Many More.
3. Swift Programming language is used for Developing Apps that would run on IOS Operating System.
4. In iOS Operating System we can perform Multitask like Chatting along with Surfing on the Internet.

ADVANTAGES OF IOS OPERATING SYSTEM


1. More secure than other operating systems.
2. Excellent UI and fluid responsive
3. Suits best for Business and Professionals Generate
Less Heat as compared to Android.

DISADVANTAGES OF IOS OPERATING SYSTEM


1. More Costly.
2. Less User Friendly as Compared to Android Operating System.
3. Not Flexible as it supports only IOS devices.
4. Battery Performance is poor.
ANDROID APPLICATION ARCHITECTURE

Android operating system is a stack of software components which is roughly divided into
five sections and four main layers as shown below in the architecture diagram.

The main components of android architecture are following:-


• Applications
• Application Framework
• Android Runtime
• Platform Libraries
• Linux Kernel

LINUX KERNEL
Linux Kernel is heart of the android architecture. It manages all the available drivers such as display drivers, camera
drivers, Bluetooth drivers, audio drivers, memory drivers, etc. which are required during the runtime.
The Linux Kernel will provide an abstraction layer between the device hardware and the other components of android
architecture. It is responsible for management of memory, power, devices etc.
The features of Linux kernel are:
• Security: The Linux kernel handles the security between the application and the system.
• Memory Management: It efficiently handles the memory management thereby providing the freedom to
develop our apps.
• Process Management: It manages the process well, allocates resources to processes whenever they need
them.
• Network Stack: It effectively handles the network communication.
• Driver Model: It ensures that the application works properly on the device and hardware manufacturers
responsible for building their drivers into the Linux build

Platform libraries –
The Platform Libraries includes various C/C++ core libraries and Java based libraries such as Media, Graphics, Surface
Manager, OpenGL etc. to provide a support for android development.
• Media library provides support to play and record an audio and video formats.
• Surface manager responsible for managing access to the display subsystem.
• SGL and OpenGL both cross-language, cross-platform application program interface (API) are used for 2D
and 3D computer graphics.
• SQLite provides database support and FreeType provides font support.
• Web-Kit This open source web browser engine provides all the functionality to display web content and to
simplify page loading.
• SSL (Secure Sockets Layer) is security technology to establish an encrypted link between a web server and a
web browser.

ANDROID LIBRARIES
This category enco mpasses those Java-based libraries that are specific to Android development.
• android.app − Provides access to the application model and is the cornerstone of all Android applications.
• android.content − Facilitates content access, publishing and messaging between applications and application
components.
• android.database − Used to access data published by content providers and includes SQLite database
management classes.
• android.opengl − A Java interface to the OpenGL ES 3D graphics rendering API.
• android.os − Provides applications with access to standard operating system services including messages,
system services and inter-process communication.
• android.text − Used to render and manipulate text on a device display.
• android.view − The fundamental building blocks of application user interfaces.
• android.widget − A rich collection of pre-built user interface components such as buttons, labels, list
views, layout managers, radio buttons etc.
• android.webkit − A set of classes intended to allow web-browsing capabilities to be built into applications.
Android runtime –
Android Runtime environment is one of the most important part of Android. It contains components like core libraries
and the Dalvik virtual machine(DVM). Mainly, it provides the base for the application framework and powers our
application with the help of the core libraries.
Like Java Virtual Machine (JVM), Dalvik Virtual Machine (DVM) is a register-based virtual machine and specially
designed and optimized for android to ensure that a device can run multiple instances efficiently. It depends on the layer
Linux kernel for threading and low- level memory management. The core libraries enable us to implement android
applications using the standard JAVA or Kotlin programming languages.

Application framework –
Application Framework provides several important classes which are used to create an Android application. It provides a
generic abstraction for hardware access and also helps in managing the user interface with application resources.
Generally, it provides the services with the help of which we can create a particular class and make that class helpful for
the Applications creation.
It includes different types of services .
•Activity Manager − Controls all aspects of the application lifecycle and activity stack.
•Content Providers − Allows applications to publish and share data with other applications.
•Resource Manager − Provides access to non-code embedded resources such as strings, color settings and
user interface layouts.
• Notifications Manager − Allows applications to display alerts and notifications to the user.
View System – extensible set of views used to create application user interfaces
An Applications –
Applications is the top layer of android architecture. The pre-installed applications like home, contacts, camera,
gallery etc and third-party applications downloaded from the play store like chat applications, games etc. will be
installed on this layer only.
It runs within the Android run time with the help of the classes and services provided by the application
framework.

ANDROID BASIC COMPONENTS


In android, application components are the basic building blocks o fcomponents willand
an application actthese
as
an entry point to allow system or user to acc ess our app.

An android component is simply a piece of code that has a well defined


life cycle e.g. Activity, Receiver, and Service etc.

The core building blocks or fundamental components of android are


activities, views, intents, services, content providers, fragments and
AndroidManifest.xml.
The following are the basic core application components that can be used in
Android application.
• Activities
• Services Content Providers
• Broadcast Receivers
• Intents
ACTIVITIES
• An activity represents a single screen with a user interface, in-short Activity performs
actions on the screen.
• Activities are said to be the presentation layer of our applications. The UI of our application is built around
one or more extensions of the Activity class.
• For example, an email application might have one activity that shows a list of new emails, another activity to
compose an email, and another activity for reading emails. If an application has more than one activity, then one
of them should be marked as the activity that is presented when the application is launched.
• An activity is implemented as a subclass of Activity class as follows −
public class MainActivity extends Activity
{
}
SERVICES
• A service is a component that runs in the background to perform long-running operations.
• Services are like invisible workers of our app.
• These components run at the backend, updating your data sources and Activities, triggering Notification, and also
broadcast Intents. They also perform some tasks when applications are not active.
• For example, a service might play music in the background while the user is in a different application, or it might
fetch data over the network without blocking user interaction with an activity.
• A service is implemented as a subclass of Service class as follows −
public class MyService extends Service
{
}
We have two types of services available in android, those are
❖ Local Services
❖ Remote Services

Local service is accessed from within the application whereas remote service is accessed remotely from other
applications running on the same device.
CONTENT PROVIDERS

• It is used to manage and persist the application data also typically interacts with the SQL
database.
• They are also responsible for sharing the data beyond the application boundaries.
• The Content Providers of a particular application can be configured to allow access from other applications, and
the Content Providers exposed by other applications can also be configured.
• A content provider component supplies data from one application to others on request. Such requests are handled
by the methods of the ContentResolver class. The data may be stored in the file system, the database or
somewhere else entirely.
A content provider is implemented as a subclass of ContentProvider class and must implement a standard set of APIs that
enable other applications to perform transactions

public class MyContentProvider


entProvider

{ Public void on create()

BROADCAST RECEIVERS

• Broadcast Receivers simply respond to broadcast messages from other applications


or from the system.
• In android, Broadcast Receiver is a component that will allow a system to deliver
events to the app like sending a low battery message to the app. The apps can also
initiate broadcasts to let other apps know that required data available in a device to
use it.
• Generally, we use Intents to deliver broadcast events to other apps and Broadcast Receivers use status bar
notifications to let the user know that broadcast event occurs.

•For example, applications can also initiate broadcasts to let other applications know that some data has been
downloaded to the device and is available for them to use, so this is broadcast receiver who will intercept this
communication and will initiate appropriate action.
• A broadcast receiver is implemented as a subclass of BroadcastReceiver class and each message is
broadcaster as an Intent object.
public class MyReceiver extends BroadcastReceiver
{ public void onReceive(context,intent){}

ANDROID INTENTS
• It is a powerful inter-application message-passing framework. They are extensively
used throughout Android.
• Intents can be used to start and stop Activities and Services, to broadcast messages system-wide or to an
explicit Activity, Service or Broadcast Receiver or to request action be performed on a particular piece of
data.
In android, Intent is a messaging object which is used to request an action from another component. In android,
intents are mainly used to perform the following things.
• Starting an Activity
• Starting a Service
• Delivering a Broadcast
There are two types of intents available in android, those are
1. Implicit Intents
2. Explicit Intents
ADDITIONAL COMPONENTS
In android, we have additional components which are used to build the relationship between the above
components (Activities, Intents, Content Providers, Services and Broadcast Receivers) to
implement our application logic, those are
COMPONENT DESCRIPTION

Fragments These are used to represent the portion of user interface in an activity

Layouts These are used to define the user interface (UI) for an activity or app

Views These are used to build a user interface for an app using UI elements like buttons, lists,

Resources To build an android app we required external elements like images, audio files, etc.
othe than coding
Manifest File It‘s a configuration file (AndroidManifest.xml) for the application and it will contain t
information about Activities, Intents, Content Providers, Services, Broadcast
Receivers, permissions, etc.

INTENTS AND SERVICES


In Android, it is quite usual for users to witness a jump from one application to
another as a part of the whole process, for example, searching for a location on the browser and
witnessing a direct jump into Google Maps or receiving payment links in Messages Application (SMS) and on
clicking jumping to PayPal or GPay (Google Pay).
This process of taking users from one application to another is achieved by passing the Intent to the
system. Intents, in general, are used for navigating among various activities within the same
application, but note, is not limited to one single application, i.e., they can be utilized from moving from one
application to another as well.

DEFINITION
• Intent is a messaging object that you can use to request an action from an app component.
• Intent is basically an intention to do an action. It's a way to communicate between Android
components to request an action from a component, by different components.
• Intents could be Implicit, for instance, calling intended actions and explicit as well, such as opening
another activity after some operations like onClick or anything else.
• Below are some applications of Intents:
1. Sending the User to Another App
2. Getting a Result from an Activity
3. Allowing Other Apps to Start Your Activity

Some Important Method of Intent and its Description

Context.startActivity() This is to launch a new activity or get an existing activity to be action.

This is to start a new service or deliver instructions for an existing


Context.startService() service.

Context.sendBroadcast() This is to deliver the message to broadcast receivers.


DEEP LINKING
• Deep Link is an URL that redirects the device to the API of that Missing
Application and then service is run on the system to check if a version of that
application exists on the device.
• For time being, let‘s assume that the application is not available on the device and no previous versions ever
existed. This service then makes a call to the Play Store from the device and the application appears, just a
matter of download.
USES OF INTENT IN ANDROID
1. To start an Activity
An Activity represents a single screen in an app. You can start a new instance of an Activity by passing an
Intent to startActivity(). The Intent describes the activity to start and carries any necessary data along.
2. To start a Service
A Service is a component that performs operations in the background and does not have a user interface.
You can start a service to perform a one-time operation(such as downloading a file) by passing an Intent to
startService(). The Intent describes which service to start and carries any necessary data.
3. To deliver a Broadcast
A broadcast is a message that any app can receive. The system delivers various broadcasts for system
events, such as when the system boots up or the device starts charging. You can deliver a broadcast to other apps by
passing an Intent to sendBroadcast() or sendOrderedBroadcast().

TYPES OF ANDROID INTENTS


There are two types of intents in android:
1. Implicit and
2. Explicit.

Implicit Intent
Implicit Intent doesn’t specify the component. In such a case, intent provides
information on available components provided by the system that is to be invoked. For
example, you may write the following code to view the webpage.

• In Implicit Intents we do need to specify the name of the component. We just specify the Action which has
to be performed and further this action is handled by the component of another application.
• The basic example of implicit Intent is to open any web page

Let‘s take an example to understand Implicit Intents more clearly. We have to open a website using intent in
your application. See the code snippet given below
Intent intentObj = new Intent(Intent.ACTION_VIEW);
intentObj.setData(Uri.parse("https://www.abhiandroid.com")); startActivity(intentObj);

Explicit Intent

Explicit Intent specifies the component. In such a case, intent provides the external class to be
invoked.

• Explicit Intents are used to connect the application internally.


• In Explicit we use the name of component which will be affected by Intent. For Example: If we know class
name then we can navigate the app from One Activity to another activity using Intent. In the similar way we
can start a service to download a file in background process.

Explicit Intent work internally within an application to perform navigation and data transfer. The
below given code snippet will help you understand the concept of Explicit Intents
Intent intent = new Intent(getApplicationContext(), SecondActivity.class); startActivity(intent);

SERVICES

• Android offers the Service class to create application components specifically to handle
operations and functionality that should run invisibly, without a user interface.
• A service is a component that runs in the background to perform long-running operations
without needing to interact with the user and it works even if application is destroyed.
• A service is a component which runs in the background without direct interaction with the user. As the
service has no user interface, it is not bound to the lifecycle of an activity.
• By using Services, you can ensure that your applications continue to run and respond to events, even when
they‘re not in active use. Services run without a dedicated GUI, but, like Activities and Broadcast Receivers,
they still execute in the main thread of the application‘s process.
• To help keep your applications responsive, Unlike Activities, which present a rich graphical interface to
users, Services run in the background updating your Content Providers, firing Intents, and
triggering notifications.
• They are the perfect way to perform regular processing or handle events even after your application‘s
Activities are invisible, inactive, or have been closed. With no visual interface,
Services are started, stopped, and controlled from other application components including other Services,
Activities, and Broadcast Receivers.
• If your application regularly, or continuously, performs actions that don‘t depend directly on user input,
Services may be the answer.
Started Services receive higher priority than inactive or invisible Activities, making them
less likely to be terminated by the run time’s resource management. The only time Android
will stop a Service prematurely is when it‘s the only way for a foreground Activity to gain required resources;
if that happens, your Service will be restarted automatically when resources become available.
Applications that update regularly but only rarely or intermittently need user interaction are good candidates
for implementation as Services. MP3 players and sports-score monitors are examples of applications that should
continue to run and update without an interactive visual component (Activity) visible.

□ There is nor onPause() or onResume() in Services as like in Activity.


□ Services doesn‘t have UI.

SERVICES CAN BE OF TWO TYPES – STARTED AND BOUND

STARTED SERVICE

Started services are those that are launched by other application components like an Activity or a
Broadcast Receiver. They can run indefinitely in the background until stopped or destroyed by the system to
free up resources.

BOUND SERVICES

A Bound Service is the server in a client- server interface. A Bound Service allows components (such
as Activities) to bind to the service, send requests, receive responses and even perform inter-process
communication (IPC).
While working with Android services, there comes a situation where we would want the
service to communicate with an activity. To accomplish this task one has to bind a service to an
activity, this type of service is called an android bound service. After a service is bound to an activity
one can return the results back to the calling activity.

Onbind()
The system calls this method when
another component wants to bind with
the service by calling bindService(). If you implement this method, you must provide an interface that
clients use to communicate with the service, by returning an IBinder object. You must always implement this
method, but if you don't want to allow binding, then you should return null.
Onunbind()
The system calls this method when all clients have disconnected from a particular interface published
by the service. Started services cannot return results/values or interact with its starting
component. Bound services on the other hand can send data to the launching component
(client). So for example a bound service might be playing an audio file and sending data regarding audio
start/pause/stop and the time elapsed to the launching Activity component so that the UI can be updated
accordingly.

UNDERSTANDING STARTED AND BOUND SERVICE BYBACKGROUND MUSIC


EXAMPLE
Suppose, I want to play music in the background, so call start Service () method. But I want to get information of the current song
being played, I will bind the service that provides information about the current song

RUNNING A SERVICE IN THE FOREGROUND

A Foreground Service is one where the user is actively aware of it putting it on high
priority hence won’t be killed when the system is low on memory. It must provide a notification for the
status bar which cannot be dismissed unless the Service is stopped or removed from the foreground. A
good example of such a notification is a music player that shows the current song and other action buttons
like play/pause, next, previous, etc. in a notification in the status bar. VOIP calls or file download apps could
also start a foreground Service and show similar notifications.

STOPPING A SERVICE
You stop a service via the stopService() method. No matter how frequently you called
the startService(intent) method, one call to the stopService() method stops the service. A
service can terminate itself by calling the stopSelf() method. This is typically done if the service finishes
its work.

TOASTS
A toast provides simple feedback about an operation in a small popup. It only fills the amount
of space required for the message and the current activity remains visible and interactive. For example,
navigating away from an email before you send it triggers a "Draft saved" toast to let you know that you can
continue editing later. Toasts automatically disappear after a timeout.
Android offers several techniques for applications to communicate with users without an Activity. Toasts are
a transient, non-modal dialog-box mechanism used to display information to users without stealing focus from the
active application. Where Toasts are silent and transient, Notifications represent a more robust
mechanism for alerting users. In many cases, when the user isn‘t actively using the mobile phone it sits
silent and unwatched in a pocket or on a desk until it rings, vibrates, or flashes. Should a user miss these alerts,
status bar icons are used to indicate that an event has occurred. All these attention-grabbing antics are available to
your Android application through Notifications
.
STORING AND RETRIEVING DATA

Android provides several ways to store and share data, including access to the filesystem,
a local relational database through SQLite, and a preferences system that allows you to store
simple key/value pairs within applications.
Android also allows applications to share data through a clever URI-based approach called a Content Provider.
This technique combines several other Android concepts, such as the URI-based style of intents and the Cursor
result set seen in SQLite, to make data accessible across different applications.
• Shared Preferences
• Internal Storage
• External Storage
• SQLite Databases
• Network Connection

DIFFERENT STORAGE OPTIONS IN ANDROID

CONTENT PROVIDERS

• Consider the structured data added to the device from application1 is not accessible to another application2
present in the same device but the profile photo added to the device by application1 is available to the
application2 running in the same device
• Consider android device as a city, the applications in it are the houses in the city, people in the
houses(application) are the data.
• Now content provider is like an broker in the city(android device). This broker provide
access for the people in the city for finding different houses referring as the content
provider in the android device provide access for the data in the device for different
applications.

SHARED PREFERENCES

• Consider I have an App say a Face book App which I use to log in to my account.
• Now the very first time I enter my username and password to get access to my account. Say I log out of the
application an hour later again I use the same Face book App to login again to my application.
• I have to enter username and password again to login to my account and I set a theme to my
application and other settings on how my app looks in my current phone
• This is un-necessary because consider I am using my phone to login to the application. So I will
always use my phone to login again and again, thus entering my credentials again and again is more work
shows it‘s not a user friendly app
• Shared Preferences is very handy in such scenarios where I can use its feature to
share my data in a xml file Which physically exists in the Android app installed in
my phone which is not destroyed even if the app is closed. Here we can save user
preferences data of the current application.

• Application preferences are simple name/value pairs like ―greeting=hello na―sound = of‖
me‖ or
• To work with preferences, Android offers an extremely simple approach
• Preferences c a n o n ly b e s h a re d w i t h o t h e r c o m n epnot s i n t h e
same package
• Preferences cannot be shared across packages
• Private preferences will not be shared at all
• Storage location is not defined and inaccessible for other applications.

FILE STORAGE

• In Android we can use the device storage space to store the data in it for the applications.
The type of data involves things such as a text file, image file, video file, audio file etc.
• We can see that there are two places we can do this. One way is to write the raw files into primary
/secondary storage. Another way is to write the cache files into the primary/secondary storage.
• There is also difference between storing raw data and the cache data, the raw data once stored
in memory by user has to be explicitly deleted by the user explicitly otherwise it would exist till
then. Cache data stored in memory is not a permanent data because the system automatically deletes it if
it feels there is shortage of memory.
INTERNAL STORAGE
• Conside
r a user in an application has stored data in internal stora ge, then only that user of that
applicat
ion has access to that data on the mobile and that data is auto matically deleted when the user
uninstal ls the application. Speaking of which internal memory is private.
• The ap ps internal storage directory is stored usingname the package name in a
special place in the android file system.
• Other ap ps or users of current app have no access to the file setparticular
by a user and a particular
app unl ess it is explicitly made available to the user for readable/writ
able access.

SQL ite

• Sqlite is used to store more structured data locally in a mobile where the android app is running.
Structured data involves as of which shown in the figure like a student’s information in the form
of rows and columns.
• Sqlite offers similar functionality like Mysql and oracle but with limited functional
features. Some of the things involve performing query operations on tables. There are features though
like creating views but also some features are not available like stored procedure.
• Sqlite is very helpful in storing complex and large data which can be downloaded once and
can be used again and again until the application is running. When the application is closed the sqlite
database is also destroyed.

PUTTING ALL THE PIECES TOGETHER


SharedPreferences is mainly for application-specific settings that you can access via your Settings menu
- like application settings. It's a good idea to keep everything simple here - mostly boolean flags, short strings, or
integers. SharedPreferences data persist on device reboot, and are removed along with app uninstallation. Data is
saved as a key-value pair.

Internal Storage is mostly used for larger non-persistent data storage. You utilize internal storage if you want to
process an image, a short video clip, a large text file, etc. But you don't store the processed data in the internal
storage - its function is more like a CPU's RAM. The amount of available internal storage for your application
depends on the device, but it's always a good idea to keep anything under 1MB. Data is referenced via its file path.

External Storage does not only refer to the SDCard storage, but for higher-end phones, this can mean internal
mountable storage (like in the Galaxy Nexus or S2). This is where you store the large video files, the high-
resolution images, and the 20-megabyte text file you want to parse in your application. This is also a place to store
data that you want shared across devices if you swap sd cards. Data is also referenced via its file path.

SQLite Databases is where you'd store pretty much anything you want in a regular database - with the advantage
of organizing things into tables, rows, and columns. It works best with things that you want displayed in the nows
as the CursorAdapter. UI as lists - the best example would be the great invention k
Data stored her e also persist on device reboot, and are removed with app
ss applications with sqlite db if you hook it up to a Conten
where you can call methods as if you're executing sql statem

ection is not really a data storage technique, but can be a


vided the device is connected to the internet, using some sor
etween downloading data every time the app needs it, or h
imately lead to another of the storage options mentioned abo

uninstallation. You can also


share data acro tProvider. Data is accessed
using a Cursor, ents.

Network Conn way of persisting data for a


specific user pro t of authentication. You have
to balance out b aving a one-time data sync,
which would ult ve.

PACKAGING AND DEPLOYMENT

PACKAGING AN ANDROID APPLICATION: THE .APK FILE


Android provides an application called apk builder for generating installable Android
application files, which have the extension .apk. An .apk file is in ZIP file format, just like many other
Java-oriented application formats, and contains the application manifest, compiled application
classes, and application resources.
Android provides the utility aapt (stands for Android Asset Packaging Tool. This tool is
part of the SDK (and build system) and allows you to view, create, and update Zip-
compatible archives (zip, jar, apk). It can also compile resources into binary assets. ) for packaging the
files that make up an .apk file, but developers typically prefer to allow their development environment to use
this utility to build their applications for them. Most users simply rely on their IDE to build their .apk.

Once a developer has created an .apk file, he can choose to make it available for installation onto a device
in one of several ways:
• Using the .adb (Android Debug Bridge is a versatile command-line tool that lets you
communicate with a device (an emulator or a connected Android device). interface directory, or more
commonly by using an IDE
• (integrated development environment)
• Using an SD card
• Making the file available on a web server
• Uploading the file to the Android Market, and then selecting Install

PLACING AN APPLICATION FOR DISTRIBUTION IN THE ANDROID MARKET


• Putting an application on the Android Market is remarkably easy. The only prerequisite is that you have
a Google account such as a Gmail account.
• A $25 credit card transaction and some information about yourself are all you need to start uploading
applications to the Android Market.

API – APPLICATION PROGRAM INTERFACE


• Application program interface (API) is a set of routines, protocols, and tools for building software
applications. An API specifies how software components should interact.
• Additionally, APIs are used when programming graphical user interface (GUI) components. A good API
makes it easier to develop a program by providing all the building blocks.

DEPLOYMENT
Android application publishing is a process that makes your Android applications available to users. Infect,
publishing is the last phase of the Android application development process.

Here is a simplified check list which will help you in launching your Android application

Step Activity

1 Regression Testing Before you publish your application, you need to make sure that its
meeting the basic quality expectations for all Android apps, on all of the devices that you are
targeting. So perform all the required testing on different devices including phone and
tablets.
2 Application Rating When you will publish your application at Google Play, you will have to
specify a content rating for your app, which informs Google Play users of its maturity level.
Currently available ratings are (a) Everyone (b) Low maturity (c) Medium maturity (d) High
maturity.
3 Targeted Regions Google Play lets you control what countries and territories where your
application will be sold. Accordingly you must take care of setting up time zone, localization
or any other specific requirement as per the targeted region.

4 Application Size Currently, the maximum size for an APK published on Google Play is 50
MB. If your app exceeds that size, or if you want to offer a secondary download, you can use
APK Expansion Files, which Google Play will host for free on its server infrastructure and
automatically handle the download to devices.

5 SDK and Screen Compatibility It is important to make sure that your app is designed to run
properly on the Android platform versions and device screen sizes that you want to target.

6 Application Pricing Deciding whether you app will be free or paid is important because, on
Google Play, free app's must remain free. If you want to sell your application then you will
have to specify its price in different currencies.

7 Promotional Content It is a good marketing practice to supply a variety of high-quality


graphic assets to showcase your app or brand. After you publish, these appear on your
product details page, in store listings and search results, and elsewhere.

8 Build and Upload release-ready APK The release-ready APK is what you will upload to
the Developer Console and distribute to users. You can check complete detail on how to
create a release-ready version of your app: Preparing for Release.

9 Finalize Application Detail Google Play gives you a variety of ways to promote your app
and engage with users on your product details page, from colourful graphics, screen shots,
and videos to localized descriptions, release details, and links to your other apps. So you can
decorate your application page and provide as much as clear crisp detail you can provide.

EXPORT ANDROID APPLICATION PROCESS

Apk development process

Before exporting the apps, you must some of tools


• Dx tools(Dalvik executable tools ): It going to convert .class file to .dex file. it has useful for memory
optimization and reduce the boot-up speed time
• AAPT(Android assistance packaging tool):it has useful to convert .Dex file to.Apk
• APK(Android packaging kit): The final stage of deployment process is called as .apk.
To export an application, just open that application project in Android studio and select Build → Generate
Signed APK from your Android studio and follow the simple steps to export your application −

Next select, Generate Signed APK option as shown in the above screen shot and then click it so that you get
following screen where you will choose Create new keystore to store your application.

Enter your key store path,key store password,key alias and key password to protect your application and click on
Next button once again. It will display following screen to let you create an application −

To create a deployment configuration:

1. For development, choose Run and then Debug Configurations. For

production, choose Run and then Run Configurations

2. Navigate to MAF Application, and right-click and choose New to create a new configuration

3. Do the following:

o Accept the default name for the configuration or enter a new one.

o Choose the Assembly project.

o Choose the target from the list of those available and the device or emulator from the list of those
available. If necessary, refresh the list.

o If necessary, select the keystore and key alias for the device you are deploying to.

4. If you want to dep loy immediately, click Run. To save the configuration click
pply.AAlternatively
click Close and in the Save Changes dialog, click Yes.
DIFFERENCES BETWEEN RUN CONFIGURATIONS AND DEBUG CONFIGURATIONS

The Run Configurations and Debug Configurations are both invoked from the Run menu, and they differ in that
Debug Configurations has an additional tab, the Debug tab, where you set debug options
Debug—Select this option for development builds. Designating a debug build results in the inclusion of debugging
symbols.

• During development, you should choose debug in order to use the default
keystore.

At runtime, MAF indicates that an application has been deployed in the debug mode by overlaying a debugging
symbol that is represented by an exclamation point within a red triangle.

• Run—Select to compile the build ready for release, with libraries, and so on.
release bits and libraries, and so on.

SECURITY AND HACKING

Mobile security is the protection of smartphones, tablets, laptops and other portable
computing devices, and the networks they connect to, from threats and vulnerabilities associated
with wireless computing.

GENERAL SECURITY ISSUES


• Confidentiality
• Integrity
• Availability
• Legitimate
• Accountability

WIRELESS SECURITY ISSUES


Wireless security issues are considered as the primary security issues of
mobile computing. These are related to wireless networks. These issues occur when the hackers
intercept the radio signals. Most wireless networks are dependent on other private networks, which are managed by
others, so after these issues, the users have less control of security procedures. These security issues are:

DENIAL OF SERVICE (DOS) ATTACKS


• The denial of services or DOS attacks is one of the most common attacks of all kinds of networks
and especially in a wireless network.
• It prevents users from using network services because the attacker sends a large amount of
unnecessary data or connection requests to the communication server.
• It causes a slow network, and therefore the users cannot get benefitted from using its service.
TRAFFIC ANALYSIS
• Traffic analysis is used to identify and monitor communication between users.
• In this process, the service provider listens the traffic flowing in the wireless channel to access
the private information of users affected by the attacker.
EAVESDROPPING
• It specifies that the attacker can log on to the wireless network and access sensitive data if the
wireless network was not secure enough. This can also be done if the information is not encrypted.
SESSION INTERCEPTION AND MESSAGES MODIFICATION
• It specifies that the attacker can intercept the session and modify the
transmitted data in this session. This scenario is called "man in the middle." It
inserts the attacker's host between the sender and receiver host.
SPOOFING
• In this security issue, the attacker impersonates him as an authorized account of another user and tries
to access the sensitive data and unauthorized services.
CAPTURED AND RETRANSMITTED MESSAGES
• In this security issue, the attacker can get some of the network services by getting unauthorized
access. After capturing the message, he/she can reply to it with some modifications to the same
destination or another.
DEVICE SECURITY ISSUES
Following is a list of some mobile computing security issues we face using mobile devices:
PUSH ATTACKS
In the push attack, the attacker creates a malicious code at the user's mobile device by hacking it and then
he/she may spread it to affect other elements of the network.
PULL ATTACKS
The pull attack is a type of attack where the attacker controls the device and handles it in his/her way. He can
decide which emails they want to receive. In this attack, the user can decide about the obtained data by the
device itself.
FORCED DE-AUTHENTICATION
In this security issue, the attackers convince the mobile end-point or the mobile user to drop its connection
and re-connection to get a new signal. Within this process, they insert their device between the mobile device
and the network and steal the information or do the fraud.
MULTI-PROTOCOL COMMUNICATION
The multi-protocol communication provides the ability of many mobile devices to operate using
multiple protocols. For example, A cellular provider's network protocol. Most of the protocols have some
security loopholes, which help the attacker to exploit this weakness and access to the device. MOBILITY
This security issue may occur because of the mobility of the users and the mobile devices. You may face
these security threats due to a user's location, so you must replicate the user profiles at different locations to
allow roaming via different places without any concern regarding access to personal and sensitive data in any
place and at any time. This repetition of sensitive data on different sites can increase seethe chances of
security threats.
DISCONNECTIONS
These types of security issues occur when mobile devices go to different places. It occurs in the form of
frequent disconnections caused by external parties resulting in the handoff.

HACKING

Phone hacking involves any method where someone forces access into your phone or its communications.
This can range from advanced security breaches to simply listening in on unsecured internet connections. It
can also involve physical theft of your phone and forcibly
hacking into it via methods like brute force. Phone hacking can happen to all kinds of phones, including Androids
and iPhones
HOW TO KNOW IF SOMEONE IS HACKING YOUR PHONE

One or more of these could be a red flag that some has breached your phone:
Your phone loses charge quickly. Malware and fraudulent apps sometimes use malicious code that tends to
drain a lot of power.
Your phone runs abnormally slowly. A breached phone might be giving all its processing power over to the
hacker‘s shady applications. This can cause your phone to slow to a crawl.
Unexpected freezing, crashes, and unexpected restarts can sometimes be symptoms.
You notice strange activity on your other online accounts. When a hacker gets into your phone, they will
try to steal access to your valuable accounts. Check your social media and email for
password reset prompts, unusual login locations or new account signup verifications.
You notice unfamiliar calls or texts in your logs. Hackers may be tapping your phone with an SMS trojan.
Alternatively, they could be impersonating you to steal personal info from your loved ones. Keep an eye out,
since either method leaves breadcrumbs like outgoing messages.

ANDROID HACKING TOOLS / ANDROID HACKING APPS


In addition to manual coding, there are many applications built around hacking Android systems. These range
from apps targeted at end users who want to extend their Android device's battery life or customize other parts
of its operating system to deep system hacks used by more sophisticated hackers and attackers.

Here are a few of the most popular:

• Apktool – This tool is used for reverse engineering third party, closed,
binary Android applications.
• Dex2jar – This widely available tool works with Android .dex and Java .class
files, enabling the conversion of one binary format to another.
• JD-GUI – This is a graphic utility tool that stands alone and displays Java sources
from .class files.

THE THREE BIGGEST THREATS TO ANDROID DEVICES


Threat One: Data in Transit
Mobile devices, including those running Android as an operating system, are susceptible to man- in-the-
middle attacks and various exploits that hack into unsecured communications over public Wi-Fi networks
and other wireless communication systems.
Threat Two: Untrustworthy App Stores
Untrustworthy app stores can cause headaches due to lack of security protocols. Ensure that your app store
of choice for Android applications takes adequate security precautions and has a strong security review
program in place.
Threat Three: SMS Trojans
Malicious apps can sometimes include SMS trojans, which come in the form of compromised applications.
This type of app accesses a mobile device's calling or text message capabilities, allowing them to do things
like send text messages with malicious links to everyone in a user's address book. These links can then be
used by attackers to distribute computer worms and other malicious messages to fee-based services, incurring
fees on behalf of the user and profiting scammers.

THREE WAYS TO PROTECT YOUR ANDROID DEVICES


Use TLS Encryption
OWASP shows that insufficient encryption is a big problem for many types of applications. By using
Transport Layer Security (TLS), you can encrypt internet traffic of all types for securely generating and
exchanging session keys. This protects data against most man-in-the-middle and network spying attacks.

Test Third-Party App Security

The best way to avoid malicious apps is to only use apps from the official Google Play store. Google Play
uses significantly better security checks than third-party sites, some of which may contain hundreds of
thousands of malicious apps. If you absolutely need to download an app from a third-party store, check its
permissions before installing, and be on the lookout for apps which that for your identity or the ability to
send messages to your contacts when they don't need to.

Use Caution When Using SMS Payments


Set your Android phone to limit the ability of apps to automatically spend your money. Apps that ask for
payment via SMS are a red flag and should be avoided if at all possible.

You might also like