0% found this document useful (0 votes)
74 views81 pages

MCC New

a

Uploaded by

S.E.-B2017 MGM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views81 pages

MCC New

a

Uploaded by

S.E.-B2017 MGM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 81

MGM's College of Engineering and Technology

Kamothe, Navi Mumbai-410209

Department of Computer Engineering

Lab Manual
Fourth Year / Semester-VII
Subject: Mobile Computing Communication

Prepared By, Approved By,

Dhanashri Patil Dr.K.Sankar


Assistant Professor HOD / CE
Departmental Program Educational Objectives
(PEOs)
1. Learn and Integrate
To provide Computer Engineering students with a strong foundation in the mathematical,
scientific and engineering fundamentals necessary to formulate, solve and analyze engineering
problems and to prepare them for graduate studies.

2. Think and Create


To develop an ability to analyze the requirements of the software and hardware, understand the
technical specifications, create a model, design, implement and verify a computing system to
meet specified requirements while considering real-world constraints to solve real world
problems.

3. Broad Base
To provide broad education necessary to understand the science of computer engineering and the
impact of it in a global and social context.

4. Techno-leader
To provide exposure to emerging cutting edge technologies, adequate training & opportunities to
work as teams on multidisciplinary projects with effective communication skills and leadership
qualities.

5. Practice citizenship
To provide knowledge of professional and ethical responsibility and to contribute to society
through active engagement with professional societies, schools, civic organizations or other
community activities.

6. Clarify Purpose and Perspective


To provide strong in-depth education through electives and to promote student awareness on the life-
long learning to adapt to innovation and change, and to be successful in their professional work or
graduate studies.

2|Page
Departmental Program Outcomes (POs)

1. Engineering Knowledge: Apply the knowledge of mathematics science engineering


fundamentals, and an engineering specialization to the solution of complex engineering problem.

2. Problem Analysis: Identify, formulate, review research, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, naturalizing
sciences, and engineering sciences.

3. Design/Development of Solutions: Design solutions for complex engineering problems and


design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.

4. Conduct Investigations of Complex Problems: Use research-based knowledge and research


methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.

5. Modern Tool Usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities
with an understanding of the limitations.

6. The Engineer and Society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to
the professional engineering practice.

7. Environment and Sustainability: Understand the impact of the professional engineering


solutions in societal and environmental contexts, and demonstrate the knowledge and need for
sustainable development.

8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.

9. Individual and Team Work: Function effectively as an individual and as a member or leader
in diverse teams and individual and as a member or leader in diverse teams and in
multidisciplinary settings.

10. Communication: Communicate effectively on complex engineering activities with the


engineering community and with society at large, such as being able to comprehend and write
effective reports and design documentation, give and receive clear instructions.

11. Project Management and Finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work as a member and
leader in a team to manage projects and in multidisciplinary environments.

3|Page
12. Life-Long Learning: Recognize the need for and have the preparation and ability to engage
in independent and lifelong learning in the broadest context of technological change.

4|Page
Index
Sr.No. Contents Page No.
1. List of Experiments
2. Course Objective, Course Outcomes and
Experiment Plan
3. CO-PO Mapping
4. Study and Evaluation Scheme
5. Experiment No. 1
6. Experiment No. 2
7. Experiment No. 3
8. Experiment No. 4
9. Experiment No. 5
10. Experiment No. 6
11. Experiment No. 7
12. Experiment No. 8
13. Experiment No. 9
14. Experiment No. 10

5|Page
List of Experiments
Sr.No. Experiments Name
1 To setup and configuration of android studio to develop mobile application.
2 Develop an application that uses GUI components.
3 Write a mobile application to calculator.
4 To implement mobile node discovery.
5 Develop an application that makes use of database
6 To setup and configuration of Wireless Access Point using NS2.
7 Write a mobile application to create alarm clock.
8 Develop an application that writes data to the SD card.
9 Implement an application that creates alert upon receiving a message.
10 Write an application that draws basic graphical primitives on the screen.

6|Page
Course Objectives & Course Outcome,
Experiment Plan
Course Objectives:

To To introduce the basic concepts and principles in mobile computing. This includes
1. major techniques involved, and networks & systems issues for the design and
implementation of mobile computing systems and applications.

2. To explore both theoretical and practical issues of mobile computing.

To provide an opportunity for students to understand the key components and


3. technologies involved and to gain hands-on experiences in building mobile
applications.

Course Outcomes:

Student will identify basic concepts and principles in mobile communication &
CO1 computing, cellular architecture.
CO2 Student will describe the components and functioning of mobile networking.
CO3 Student will classify variety of security techniques in mobile network:

CO4 Student will apply the concepts of WLAN for local as well as remote applications.
CO5 Student will describe and apply the concepts of mobility management

CO6 Student will describe Long Term Evolution (LTE) architecture and its interfaces.

7|Page
Experiment Plan
Module Week Course
Experiments Name
No. No. Outcome

To setup and configuration of android studio to develop


1 W1 mobile application.

2 W2 Develop an application that uses GUI components.

3 W3 Write a mobile application to calculator.

4 W4 To implement mobile node discovery.

5 W5 Develop an application that makes use of database

6 W6 To setup and configuration of Wireless Access Point


using NS3.
7 W7 Write a mobile application to create alarm clock.

8 W8 Develop an application that writes data to the SD card.

9 W9 Implement an application that creates alert upon


receiving a message.
Write an application that draws basic graphical
10 W10
primitives on the screen.

8|Page
Mapping Course Outcomes (CO) -
Program Outcomes (PO)
Subject Course Outcomes Contribution to Program outcomes
Weight

P10

P11

P12
P1

P2

P3

P4

P5

P6

P7

P8

P9
Student will identify basic concepts  
and principles in mobile 
CO1
communication & computing,
cellular architecture.
Student will describe the
CO2 components and functioning of
mobile networking.
Student will classify variety of
PRATICA CO3 security techniques in mobile
L network:
50%
Student will apply the concepts of
CO4 WLAN for local as well as remote
applications.
Student will describe and apply the
CO5
concepts of mobility management
Student will describe Long Term
CO6 Evolution (LTE) architecture and
its interfaces.

9|Page
Study and Evaluation Scheme
Course
Course Name Teaching Scheme Credits Assigned
Code
CPC801 Mobile Theory Practical Tutorial Theory Practical Tutorial Total
Communication 02 02 -- 100 02 -- 02
& Computing

Course Code Course Name Examination Scheme


CPC801 Mobile Term Work Practical Total
Communication 25 25 100
& Computing

Term Work:

Internal Assessment consists of two tests. Test 1, an Institution level central test, is for 20 marks
and is to be based on a minimum of 40% of the syllabus. Test 2 is also for 20 marks and is to be
based on the remaining syllabus. Test 2 may be either a class test or assignment on live problems
or course project

Practical & Oral:

Oral examination is to be conducted by pair of internal and external examiners based on the
syllabus.
10 | P a g e
Experiment No. 1

Aim: To setup and configuration of android studio to develop mobile application.

Theory:

Android Studio is the official integrated development environment (IDE) for Android application
development. It is based on the IntelliJ IDEA, a Java integrated development environment for
software, and incorporates its code editing and developer tools. To support application
development within the Android operating system, Android Studio uses a Gradle-based build
system, emulator, code templates, and Github integration. Every project in Android Studio has
one or more modalities with source code and resource files. These modalities include Android
app modules, Library modules, and Google App Engine modules.

Step 1 - System Requirements


You will be delighted, to know that you can start your Android application development on
either of the following operating systems −

 Microsoft® Windows® 10/8/7/Vista/2003 (32 or 64-bit)


 Mac® OS X® 10.8.5 or higher, up to 10.9 (Mavericks)
 GNOME or KDE desktop
Second point is that all the required tools to develop Android applications are open source and
can be downloaded from the Web. Following is the list of software's you will need before you
start your Android application programming.

 Java JDK5 or later version


 Java Runtime Environment (JRE) 6
 Android Studio

11 | P a g e
Step 2 - Setup Android Studio
Overview
Android Studio is the official IDE for android application development.It works based
on IntelliJ IDEA, You can download the latest version of android studio from Android Studio
2.2 Download, If you are new to installing Android Studio on windows,you will find a file,
which is named as android-studio-bundle-143.3101438-windows.exe.So just download and run
on windows machine according to android studio wizard guideline.

If you are installing Android Studio on Mac or Linux, You can download the latest version
from Android Studio Mac Download,or Android Studio Linux Download, check the
instructions provided along with the downloaded file for Mac OS and Linux. This tutorial will
consider that you are going to setup your environment on Windows machine having Windows
8.1 operating system.

Installation
So let's launch Android Studio.exe,Make sure before launch Android Studio, Our Machine
should required installed Java JDK. To install Java JDK,take a references of Android
environment setup

Once you launched Android Studio, its time to mention JDK7 path or later version in android
studio installer.

12 | P a g e
Below the image initiating JDK to android SDK

Need to check the components, which are required to create applications, below the image has
selected Android Studio, Android SDK, Android Virtual Machine and performance(Intel
chip).

13 | P a g e
Need to specify the location of local machine path for Android studio and Android SDK, below
the image has taken default location of windows 8.1 x64 bit architecture.

Need to specify the ram space for Android emulator by default it would take 512MB of local
machine RAM.

14 | P a g e
At final stage, it would extract SDK packages into our local machine, it would take a while time
to finish the task and would take 2626MB of Hard disk space.

After done all above steps perfectly, you must get finish button and it gonna be open android
studio project with Welcome to android studio message as shown below

15 | P a g e
You can start your application development by calling start a new android studio project. in a
new installation frame should ask Application name, package information and location of the
project.

After entered application name, it going to be called select the form factors your application
runs on, here need to specify Minimum SDK, in our tutorial, I have declared as API23: Android
6.0(Mashmallow)

16 | P a g e
The next level of installation should contain selecting the activity to mobile, it specifies the
default layout for Applications

At the final stage it going to be open development tool to write the application code.

17 | P a g e
Step 3 - Create Android Virtual Device
To test your Android applications, you will need a virtual Android device. So before we start
writing our code, let us create an Android virtual device. Launch Android AVD Manager
Clicking AVD_Manager icon as shown below

After Click on a virtual device icon, it going to be shown by default virtual devices which are
present on your SDK, or else need to create a virtual device by clicking Create new Virtual
device button

18 | P a g e
If your AVD is created successfully it means your environment is ready for Android application
development. If you like, you can close this window using top-right cross button. Better you re-
start your machine and once you are done with this last step, you are ready to proceed for your
first Android example but before that we will see few more important concepts related to
Android Application Development.

Hello Word Example


Before Writing a Hello word code, you must know about XML tags.To write hello word code,
you should redirect to App>res>layout>Activity_main.xml

To show hello word, we need to call text view with layout ( about text view and layout, you
must take references at Relative Layout and Text View ).

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"

android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
19 | P a g e
android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

<TextView android:text="@string/hello_world"

android:layout_width="550dp"

android:layout_height="wrap_content" />

</RelativeLayout>

Need to run the program by clicking Run>Run App or else need to call shift+f10key. Finally,
result should be placed at Virtual devices as shown below

Result:____________________________________________________
______________________________________________________

Conclusion:

20 | P a g e
Questionnaire

1) What is android?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

2) What are the system requires for installation of android studio?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

3) What is android SDK?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

4) What are the different versions of Android OS that you remember?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

5) What is AIDL?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

21 | P a g e
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

6) What are the data types supported by AIDL?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

7) What is Orientation?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

8) What is .apk extension in Android?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

9) Which components are necessary for a New Android project?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

10) Provide the important core components of Android.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
22 | P a g e
Experiment No. 2

Aim: Develop an application that uses GUI components.

Theory:

The basic building block for user interface is a View object which is created from the View
class and occupies a rectangular area on the screen and is responsible for drawing and event
handling. View is the base class for widgets, which are used to create interactive UI components
like buttons, text fields, etc.

The ViewGroup is a subclass of View and provides invisible container that hold other Views or
other ViewGroups and define their layout properties.

At third level we have different layouts which are subclasses of ViewGroup class and a typical
layout defines the visual structure for an Android user interface and can be created either at run
time using View/ViewGroupobjects or you can declare your layout using simple XML
file main_layout.xml which is located in the res/layout folder of your project.

Android Layout Types


Sr.No Layout & Description

1 Linear Layout

LinearLayout is a view group that aligns all children in a single direction, vertically
or horizontally.

2 Relative Layout

RelativeLayout is a view group that displays child views in relative positions.

3 Table Layout

TableLayout is a view that groups views into rows and columns.

23 | P a g e
4 Absolute Layout

AbsoluteLayout enables you to specify the exact location of its children.

5 Frame Layout

The FrameLayout is a placeholder on screen that you can use to display a single view.

6 List View

ListView is a view group that displays a list of scrollable items.

7 Grid View

GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid.

Buttons

Depending on whether you want a button with text, an icon, or both, you can create the button in
your layout in three ways:

With text, using the Button class:

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_text"
... />
With an icon, using the ImageButton class:

<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/button_icon"
... />
With text and an icon, using the Button class with the android:drawableLeft attribute:

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_text"
24 | P a g e
android:drawableLeft="@drawable/button_icon"
... />

Creating a font family


A font family is a set of font files along with its style and weight details. In Android, you can
create a new font family as an XML resource and access it as a single unit, instead of referencing
each style and weight as separate resources. By doing this, the system can select the correct font
based on the text style you are trying to use.

To create a font family, perform the following steps in the Android Studio:

1.Right-click the font folder and go to New > Font resource file. The New Resource File window
appears.

2.Enter the file name, and then click OK. The new font resource XML opens in the editor.

3.Enclose each font file, style, and weight attribute in the <font> element. The following XML
illustrates adding font-related attributes in the font resource XML:

<?xml version="1.0" encoding="utf-8"?>


<font-family xmlns:android="http://schemas.android.com/apk/res/android">
<font
android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/lobster_regular" />
<font
android:fontStyle="italic"
android:fontWeight="400"
android:font="@font/lobster_italic" />
</font-family>

Android UI Controls
There are number of UI controls provided by Android that allow you to build the graphical user
interface for your app.

Sr.No. UI Control & Description

1 TextView

This control is used to display text to the user.

25 | P a g e
2 EditText

EditText is a predefined subclass of TextView that includes rich editing


capabilities.

3 AutoCompleteTextView

The AutoCompleteTextView is a view that is similar to EditText, except that it


shows a list of completion suggestions automatically while the user is typing.

4 Button

A push-button that can be pressed, or clicked, by the user to perform an action.

5 ImageButton

An ImageButton is an AbsoluteLayout which enables you to specify the exact


location of its children. This shows a button with an image (instead of text) that
can be pressed or clicked by the user.

6 CheckBox

An on/off switch that can be toggled by the user. You should use check box
when presenting users with a group of selectable options that are not mutually
exclusive.

7 ToggleButton

An on/off button with a light indicator.

8 RadioButton

The RadioButton has two states: either checked or unchecked.

9 RadioGroup

A RadioGroup is used to group together one or more RadioButtons.

10 ProgressBar

The ProgressBar view provides visual feedback about some ongoing tasks, such
as when you are performing a task in the background.

26 | P a g e
11 Spinner

A drop-down list that allows users to select one value from a set.

12 TimePicker

The TimePicker view enables users to select a time of the day, in either 24-hour
mode or AM/PM mode.

13 DatePicker

The DatePicker view enables users to select a date of the day.

Result:____________________________________________________
______________________________________________________

Conclusion:

27 | P a g e
Questionnaire

1) What is view?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

2) What is ViewGroup?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

3) Listout all android layout type?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

4) What is Linear Layout?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

5) What is Grid View?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

6) Give fullform of XML?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

28 | P a g e
7) List all Android UI Controls.
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

8) Write all checkbox attributes.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

9) What is the use of TimePicker?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

10)What is the function of RadioButton?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

29 | P a g e
Experiment No. 3

Aim: Write a mobile application to calculator.

Theory: As with all applications, we should always start with building the interface. For the
calculator app, we require the following elements.
1.TextView
2.Buttons
That’s it. We use the textView to show users the numbers they have written and also to display
the result of the calculations we are going to do.
Each of the numbers will have a different button, from 0-9 and we will have four additional
buttons for addition, subtraction, multiplication and division. Other than this, we require a button
to calculate the operation, a button for decimals, and a button to clear the display.

Requirements
1. EditText: To display numbers and the result.
2. Button: Numbers 0-9
3. Button: Operational buttons (+, -, *, /, =)
4. Button: Decimal button
5. Button: Clear display button.
Here’s a screenshot of what the code at the bottom would look like, if you were to paste it in
your activity_main.xml file.

Coding the Functionality of our simple calculator

Step 1: Creating objects for our elements


Button btn_1, btn_2, btn_3, btn_4, btn_5, btn_6, btn_7, btn_8, btn_9, btn_0, btn_Add, btn_Sub,
btn_Mul, btn_Div, btn_calc, btn_dec, btn_clear;

Step 2: Fetching values from the elements into the working of our app
Inside the onCreate function, we will fetch all values and assign it to our objects. We do this by
the following code
btn_0 = (Button) findViewById(R.id.btn_0);
Here, we are fetching the value of ‘btn_0’, which is the ID of our button zero, and storing it in
the object ‘btn_0’ that we created earlier. Though, they are named the same, Android Studio has
the ability to identify the correct one. But if it gets confusing for you, feel free to give either one
of them any other names.
30 | P a g e
Step 3: Changing the EditText value by pressing the buttons.
Here’s the code
btn_1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ed1.setText(ed1.getText()+"1");
}
});
This is what happens when you push one. The editText, first already fetches the value that it is
already displaying, null in this case, and then adds 1 to it. If we don’t fetch the existing value
then it will become impossible to enter multiple digit numbers.

Step 4: The functional buttons.


Here’s the code we are using for multiplication.
btn_Mul.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Value1 = Float.parseFloat(ed1.getText() + "");
mMultiplication = true ;
ed1.setText(null);
}
});
We are using our first float value ‘Value1’ here. We use the simple function getText() to do that.
Here since we pressed the multiplication button, we set it’s boolean equivalent variable to true.
You will see how this is helpful in the ‘calculate’ button coding.

Step 5: Calculating, the actual functionality


Here’s the code of what happens when you or someone else presses the ‘=’ button after inputting
another integer.
btn_calc.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Value2 = Float.parseFloat(ed1.getText() + "");
if (mSubtract == true){
ed1.setText(Value1 - Value2 +"");
31 | P a g e
mSubtract=false;
}
}
});
A couple of things are happening here, firstly, we are fetching the value that you entered after
pressing one of the 4 functional buttons (+, -, *, /) and storing it in float variable ‘Value2’.
Next we execute an if-condition to check whether our four boolean values are true and then run
it’s subsequent code. In the above example, we are executing only the if condition for
subtraction. For the full code, refer to the code below.

Result:____________________________________________________
______________________________________________________

Conclusion:

32 | P a g e
Questionnaire

1) Which arithmetic operation use?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

2) Give the steps to create calculator.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

3) What are the requirements of creating calculator?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

4) What are the different buttons use in calculator?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

5) Write code for Changing the EditText value by pressing the buttons.
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

6) What is the use of setOnClickListener ?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

7) What are the different elements use for creating calculator?

33 | P a g e
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

8) Which function is use to fetch all the values?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

9) Why use EditText?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

10) Requirements for creating calculator in android studio.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

34 | P a g e
Experiment No. 4

Aim: To implement mobile node discovery.

Theory:

A mobile node is an Internet-connected device whose location and point of attachment to the
Internet may frequently be changed. This kind of node is often a cellular
telephone or handheld or laptop computer, although a mobile node can also be a router. Special
support is required to maintain Internet connections for a mobile node as it moves from one
network or subnet to another, because traditional Internet routing assumes a device will always
have the same IP address. Therefore, using standard routing procedures, a mobile user would
have to change the device's IP address each time they connected through another network or
subnet.

Since mobility and ease of connection are crucial considerations for mobile device users,
organizations that want to promote mobile communications are putting a great deal of effort into
making mobile connection and uncomplicated for the user. The Internet Engineering Task Force
(IETF) Mobile IP working group has developed several standards or proposed standards to
address these needs, including Mobile IP and later enhancements, Mobile IP version 6 (MIPv6)
and Hierarchical Mobile IP version 6 (HMIPv6).

Mobile IP Overview

In IP networks, routing is based on stationary IP addresses, similar to how a postal letter is


delivered to the fixed address on the envelope. A device on a network is reachable through
normal IP routing by the IP address it is assigned on the network.
The problem occurs when a device roams away from its home network and is no longer
reachable using normal IP routing. This results in the active sessions of the device being
terminated. Mobile IP was created to enable users to keep the same IP address while traveling to
a different network (which may even be on a different wireless operator), thus ensuring that a
roaming individual could continue communication without sessions or connections being
dropped.

35 | P a g e
Because the mobility functions of Mobile IP are performed at the network layer rather than the
physical layer, the mobile device can span different types of wireless and wireline networks
while maintaining connections and ongoing applications. Remote login, remote printing, and file
transfers are some examples of applications where it is undesirable to interrupt communications
while an individual roams across network boundaries. Also, certain network services, such as
software licenses and access privileges, are based on IP addresses. Changing these IP addresses
could compromise the network services.

Components of a Mobile IP Network

Mobile IP has the following three components, as shown in Figure 1:


• Mobile Node
• Home Agent
• Foreign Agent

Figure 1 Mobile IP Components and Relationships

The Mobile Node is a device such as a cell phone, personal digital assistant, or laptop whose
software enables network roaming capabilities.
The Home Agent is a router on the home network serving as the anchor point for communication
with the Mobile Node; it tunnels packets from a device on the Internet, called a Correspondent
Node, to the roaming Mobile Node. (A tunnel is established between the Home Agent and a
reachable point for the Mobile Node in the foreign network.)
The Foreign Agent is a router that may function as the point of attachment for the Mobile Node
when it roams to a foreign network, delivering packets from the Home Agent to the Mobile
Node.
The care-of address is the termination point of the tunnel toward the Mobile Node when it is on a
foreign network. The Home Agent maintains an association between the home IP address of the

36 | P a g e
Mobile Node and its care-of address, which is the current location of the Mobile Node on the
foreign or visited network

How Mobile IP Works

This section explains how Mobile IP works. The Mobile IP process has three main phases, which
are discussed in the following sections.
• Agent Discovery
A Mobile Node discovers its Foreign and Home Agents during agent discovery.
• Registration
The Mobile Node registers its current location with the Foreign Agent and Home Agent during
registration.
• Tunneling
A reciprocal tunnel is set up by the Home Agent to the care-of address (current location of the
Mobile Node on the foreign network) to route packets to the Mobile Node as it roams.

Agent Discovery

During the agent discovery phase, the Home Agent and Foreign Agent advertise their services on
the network by using the ICMP Router Discovery Protocol (IRDP). The Mobile Node listens to
these advertisements to determine if it is connected to its home network or foreign network.
The IRDP advertisements carry Mobile IP extensions that specify whether an agent is a Home
Agent, Foreign Agent, or both; its care-of address; the types of services it will provide such as
reverse tunneling and generic routing encapsulation (GRE); and the allowed registration lifetime
or roaming period for visiting Mobile Nodes. Rather than waiting for agent advertisements, a
Mobile Node can send out an agent solicitation. This solicitation forces any agents on the link to
immediately send an agent advertisement.
If a Mobile Node determines that it is connected to a foreign network, it acquires a care-of
address. Two types of care-of addresses exist:
• Care-of address acquired from a Foreign Agent
• Colocated care-of address
A Foreign Agent care-of address is an IP address of a Foreign Agent that has an interface on the
foreign network being visited by a Mobile Node. A Mobile Node that acquires this type of care-
of address can share the address with other Mobile Nodes. A colocated care-of address is an IP
address temporarily assigned to the interface of the Mobile Node itself. A colocated care-of
address represents the current position of the Mobile Node on the foreign network and can be
used by only one Mobile Node at a time.
When the Mobile Node hears a Foreign Agent advertisement and detects that it has moved
outside of its home network, it begins registration.

37 | P a g e
Registration

The Mobile Node is configured with the IP address and mobility security association (which
includes the shared key) of its Home Agent. In addition, the Mobile Node is configured with
either its home IP address, or another user identifier, such as a Network Access Identifier.
The Mobile Node uses this information along with the information that it learns from the Foreign
Agent advertisements to form a Mobile IP registration request. It adds the registration request to
its pending list and sends the registration request to its Home Agent either through the Foreign
Agent or directly if it is using a colocated care-of address and is not required to register through
the Foreign Agent. If the registration request is sent through the Foreign Agent, the Foreign
Agent checks the validity of the registration request, which includes checking that the requested
lifetime does not exceed its limitations, the requested tunnel encapsulation is available, and that
reverse tunnel is supported. If the registration request is valid, the Foreign Agent adds the
visiting Mobile Node to its pending list before relaying the request to the Home Agent. If the
registration request is not valid, the Foreign Agent sends a registration reply with appropriate
error code to the Mobile Node.
The Home Agent checks the validity of the registration request, which includes authentication of
the Mobile Node. If the registration request is valid, the Home Agent creates a mobility binding
(an association of the Mobile Node with its care-of address), a tunnel to the care-of address, and
a routing entry for forwarding packets to the home address through the tunnel.
The Home Agent then sends a registration reply to the Mobile Node through the Foreign Agent
(if the registration request was received via the Foreign Agent) or directly to the Mobile Node. If
the registration request is not valid, the Home Agent rejects the request by sending a registration
reply with an appropriate error code.
The Foreign Agent checks the validity of the registration reply, including ensuring that an
associated registration request exists in its pending list. If the registration reply is valid, the
Foreign Agent adds the Mobile Node to its visitor list, establishes a tunnel to the Home Agent,
and creates a routing entry for forwarding packets to the home address. It then relays the
registration reply to the Mobile Node.
Finally, the Mobile Node checks the validity of the registration reply, which includes ensuring an
associated request is in its pending list as well as proper authentication of the Home Agent. If the
registration reply is not valid, the Mobile Node discards the reply. If a valid registration reply
specifies that the registration is accepted, the Mobile Node is confirmed that the mobility agents
are aware of its roaming. In the colocated care-of address case, it adds a tunnel to the Home
Agent. Subsequently, it sends all packets to the Foreign Agent.
The Mobile Node reregisters before its registration lifetime expires. The Home Agent and
Foreign Agent update their mobility binding and visitor entry, respectively, during reregistration.
In the case where the registration is denied, the Mobile Node makes the necessary adjustments

38 | P a g e
and attempts to register again. For example, if the registration is denied because of time
mismatch and the Home Agent sends back its time stamp for synchronization, the Mobile Node
adjusts the time stamp in future registration requests.
Thus, a successful Mobile IP registration sets up the routing mechanism for transporting packets
to and from the Mobile Node as it roams.

Tunneling

The Mobile Node sends packets using its home IP address, effectively maintaining the
appearance that it is always on its home network. Even while the Mobile Node is roaming on
foreign networks, its movements are transparent to correspondent nodes.
Data packets addressed to the Mobile Node are routed to its home network, where the Home
Agent now intercepts and tunnels them to the care-of address toward the Mobile Node.
Tunneling has two primary functions: encapsulation of the data packet to reach the tunnel
endpoint, and decapsulation when the packet is delivered at that endpoint. The default tunnel
mode is IP Encapsulation within IP Encapsulation. Optionally, GRE and minimal encapsulation
within IP may be used.
Typically, the Mobile Node sends packets to the Foreign Agent, which routes them to their final
destination, the Correspondent Node, as shown in Figure 2.

Figure 2 Packet Forwarding

However, this data path is topologically incorrect because it does not reflect the true IP network
source for the data—rather, it reflects the home network of the Mobile Node. Because the
packets show the home network as their source inside a foreign network, an access control list on
routers in the network called ingress filtering drops the packets instead of forwarding them. A
feature called reverse tunneling solves this problem by having the Foreign Agent tunnel packets
back to the Home Agent when it receives them from the Mobile Node. See Figure 3.

39 | P a g e
Figure 3 Reverse Tunnel

Tunnel MTU discovery is a mechanism for a tunnel encapsulator such as the Home Agent to
participate in path MTU discovery to avoid any packet fragmentation in the routing path between
a Correspondent Node and Mobile Node. For packets destined to the Mobile Node, the Home
Agent maintains the MTU of the tunnel to the care-of address and informs the Correspondent
Node of the reduced packet size. This improves routing efficiency by avoiding fragmentation and
reassembly at the tunnel endpoints to ensure that packets reach the Mobile Node.

Security

Mobile IP uses a strong authentication scheme for security purposes. All registration messages
between a Mobile Node and Home Agent are required to contain the Mobile-Home
Authentication Extension (MHAE).
The integrity of the registration messages is protected by a preshared 128-bit key between a
Mobile Node and Home Agent. The keyed message digest algorithm 5 (MD5) in "prefix+suffix"
mode is used to compute the authenticator value in the appended MHAE, which is mandatory.
Mobile IP also supports the hash-based message authentication code (HMAC-MD5). The
receiver compares the authenticator value it computes over the message with the value in the
extension to verify the authenticity.
Optionally, the Mobile-Foreign Authentication Extension and Foreign-Home Authentication
Extension are appended to protect message exchanges between a Mobile Node and Foreign
Agent and between a Foreign Agent and Home Agent, respectively.
Replay protection uses the identification field in the registration messages as a timestamp and
sequence number. The Home Agent returns its time stamp to synchronize the Mobile Node for
registration.
Cisco IOS software allows the mobility keys to be stored on an authentication, authorization, and
accounting (AAA) server that can be accessed using TACACS+ or RADIUS protocols. Mobile

40 | P a g e
IP in Cisco IOS software also contains registration filters, enabling companies to restrict who is
allowed to register.

Solution to Network Mobility

Network mobility is enabled by Mobile IP, which provides a scalable, transparent, and secure
solution. It is scalable because only the participating components need to be Mobile IP aware—
the Mobile Node and the endpoints of the tunnel. No other routers in the network or any hosts
with which the Mobile Node is communicating need to be changed or even aware of the
movement of the Mobile Node. It is transparent to any applications while providing mobility.
Also, the network layer provides link-layer independence, interlink layer roaming, and link-layer
transparency. Finally, it is secure because the set up of packet redirection is authenticated.

Result:____________________________________________________
______________________________________________________

Conclusion:

41 | P a g e
Questionnaire

1) What is mobile node?


---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
2) List out mobile IP network components.
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
3) List out versions of mobile IP.
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
4) What is tunnel?
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
5) How mobile IP work?
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
6) _____________________Software allows the mobility keys to be stored on an authentication,
authorization, and accounting (AAA) server that can be accessed using TACACS+ or RADIUS
protocols.

7) What is agent discovery?


---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

42 | P a g e
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
8) Why network mobility scalable?
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

9) What is the function of home agent?


---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

10) What is a role RADIUS protocol?


---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

43 | P a g e
Experiment No.5

Aim: Develop an application that makes use of database.

Theory:

SQLite is a opensource SQL database that stores data to a text file on a device. Android comes
in with built in SQLite database implementation.
SQLite supports all the relational database features. In order to access this database, you don't
need to establish any kind of connections for it like JDBC,ODBC e.t.c

Database - Package
The main package is android.database.sqlite that contains the classes to manage your own
databases
Database - Creation
In order to create a database you just need to call this method openOrCreateDatabase with your
database name and mode as a parameter. It returns an instance of SQLite database which you
have to receive in your own object.Its syntax is given below

SQLiteDatabase mydatabase = openOrCreateDatabase("your database


name",MODE_PRIVATE,null);

Apart from this , there are other functions available in the database package , that does this job.
They are listed below

Sr.No Method & Description

1 openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags,


DatabaseErrorHandler errorHandler)
This method only opens the existing database with the appropriate flag mode. The
common flags mode could be OPEN_READWRITE OPEN_READONLY

2 openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags)


It is similar to the above method as it also opens the existing database but it does
not define any handler to handle the errors of databases

3 openOrCreateDatabase(String path, SQLiteDatabase.CursorFactory factory)

44 | P a g e
It not only opens but create the database if it not exists. This method is equivalent
to openDatabase method.

4 openOrCreateDatabase(File file, SQLiteDatabase.CursorFactory factory)


This method is similar to above method but it takes the File object as a path rather
then a string. It is equivalent to file.getPath()

Database - Insertion
we can create table or insert data into table using execSQL method defined in SQLiteDatabase
class. Its syntax is given below

mydatabase.execSQL("CREATE TABLE IF NOT EXISTS TutorialsPoint(Username


VARCHAR,Password VARCHAR);");
mydatabase.execSQL("INSERT INTO TutorialsPoint VALUES('admin','admin');");

This will insert some values into our table in our database. Another method that also does the
same job but take some additional parameter is given below

Sr.No Method & Description

1 execSQL(String sql, Object[] bindArgs)


This method not only insert data , but also used to update or modify already
existing data in database using bind arguments

Database - Fetching
We can retrieve anything from database using an object of the Cursor class. We will call a
method of this class called rawQuery and it will return a resultset with the cursor pointing to the
table. We can move the cursor forward and retrieve the data.

Cursor resultSet = mydatbase.rawQuery("Select * from TutorialsPoint",null);


resultSet.moveToFirst();
String username = resultSet.getString(0);
String password = resultSet.getString(1);
There are other functions available in the Cursor class that allows us to effectively retrieve the
data. That includes

Sr.No Method & Description

1 getColumnCount()
This method return the total number of columns of the table.

45 | P a g e
2 getColumnIndex(String columnName)
This method returns the index number of a column by specifying the name of the
column

3 getColumnName(int columnIndex)
This method returns the name of the column by specifying the index of the
column

4 getColumnNames()
This method returns the array of all the column names of the table.

5 getCount()
This method returns the total number of rows in the cursor

6 getPosition()
This method returns the current position of the cursor in the table

7 isClosed()
This method returns true if the cursor is closed and return false otherwise

Example
Here is an example demonstrating the use of SQLite Database. It creates a basic contacts
applications that allows insertion, deletion and modification of contacts.
To experiment with this example, you need to run this on an actual device on which camera is
supported.

Steps Description

1 You will use Android studio to create an Android application under a package
com.example.sairamkrishna.myapplication.

2 Modify src/MainActivity.java file to get references of all the XML components and
populate the contacts on listView.

3 Create new src/DBHelper.java that will manage the database work

4 Create a new Activity as DisplayContact.java that will display the contact on the
screen

46 | P a g e
5 Modify the res/layout/activity_main to add respective XML components

6 Modify the res/layout/activity_display_contact.xml to add respective XML


components

7 Modify the res/values/string.xml to add necessary string components

8 Modify the res/menu/display_contact.xml to add necessary menu components

9 Create a new menu as res/menu/mainmenu.xml to add the insert contact option

10 Run the application and choose a running android device and install the application
on it and verify the results.

Result:____________________________________________________
______________________________________________________

Conclusion:

47 | P a g e
Questionnaire

48 | P a g e
Experiment No. 6

Aim: To setup and configuration of Wireless Access Point using NS2.


Theory:
NS2
NS2 stands for Network Simulator Version 2. It is an open-source event-driven simulator
designed specifically for research in computer communication networks.

Features of NS2
1. It is a discrete event simulator for networking research.
2. It provides substantial support to simulate bunch of protocols like TCP, FTP, UDP, https and
DSR.
3. It simulates wired and wireless network.
4. It is primarily Unix based.
5. Uses TCL as its scripting language.
6. Otcl: Object oriented support
7. Tclcl: C++ and otcl linkage
8. Discrete event scheduler

NS2 builds and runs under windows using Cygwin. Cygwin provides Linux like environment
under windows.

System Requirements: A computer with C++ compiler. Building full NS2 package requires large
memory space approximately 250MB

I. Steps to install NS 2 on windows 7 are given below:

1. Download Cygwin from following link https://www.cygwin.com/setup.exe

2. Run the downloaded setup.exe and you will see screen shown below click next.

49 | P a g e
6. Next screen will ask for your Internet connection type keep it as "Direct connection" and click
next and in next screen choose one site to download the packages and click next.

7. In next screen Cygwin will allow to select the packages you want to install

50 | P a g e
8. Uncheck the option "Hide obsolete packages" then click on "view" button till the word
"category" changes to "Full"

To install NS2 you need to select and install following packages:

To install NS2 you need to select and install following packages:

1. gcc
2. gcc-g++
3. gnuplot
4. make
5. patch
6. perl
7. tar
8. X-startup-scripts
9. xorg-x11-base
10. xorg-x11-bin
11. xorg-x11-devel
12. xorg-x11-bin-dlls

51 | P a g e
13. xorg-x11-bin-lndir
14. xorg-x11-etc
15. xorg-x11-fenc
16. xorg-x11-fnts
17. xorg-x11-libs-data
18. xorg-x11-xwin
19. libxt-devel
20. libXmu-devel

To select a package search the package name and click on word "skip" this will change it to
version number of the package. Do this for all above packages and click next to start download
and installation

9. Once installation is complete create desktop icons if you need.

II. Steps is to install NS2

1. Download NS2 from following link: https://www.isi.edu/nsnam/dist/ns-allinone-2.28.tar.gz

52 | P a g e
2. Decompress the file use winrar. Copy the decompressed folder the Cygwin installation
directory under the subdirectory home. It will be C:\cygwin\home\system_name : where
system_name is name of your system in above Cygwin installation this path will be
C:\Cygwin\home\sys27

3. Run Cygwin from desktop and change the directory to folder you copied just now in step 2
command to change directory:cd /home/sys27/ns-allinone-2.28

NOTE: please change sys27 to name of your system

4. To start installation type following command:"./install"(WITHOUT qoutes)

This will began the installation process if any Cygwin package is missing it will be reported to
you if so the run Cygwin setu.exe and install the missing package and start again from step 2.

Installation is a long process and take quite some time once it is finished you will get a screen as
shown below:

5. Add following lines to the .bashrc

export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library

53 | P a g e
export

PATH=$NS_HOME/nam-
1.11:$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/bin:$PATH

export
LD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/otcl-
1.9:$NS_HOME/lib:$LD_LIBRARY_PATH

export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library

NOTE: replace sys27 with your system name

7. To check if NS2 is installed correctly you can run one sample example given in ns-tutorials
folder

8. To run the example change the directory to examples folder: cd ./home/sys27/ns-allinone-


2.28/ns-tutorial/examples

Then type following command:

ns example2.tcl

54 | P a g e
55 | P a g e
NOTE: If you missed any package while installing Cygwin first time you can install it by running
the setup.exe again and selecting the package in step 8.

10. Cygwin installation is complete now you can run Cygwin from desktop and see its interface.

3. Select option "Install From Internet". If you have already downloaded the package select
"Install from local directory" and click next

56 | P a g e
4. Keep the default installation directory as "C:\cygwin" and click next

5. Keep default local package directory as your download folder and click next.

57 | P a g e
Result:____________________________________________________
______________________________________________________

Conclusion:

58 | P a g e
Questionnaire

1) What is NS2?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

2) What is simulator?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

3) What are the different features of NS2?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

4) What are the advantages and disadvantages of Simulation?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

5) What is the need for Simulation?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

59 | P a g e
6) Enlist atleast four network softwares that can be used to develop and simulate network
applications?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

7) Explain the following with respect to NS2 NAM?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

8) List all the packages for the installation of NS2.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

60 | P a g e
Experiment No.7

Aim: Write a mobile application to create alarm clock.

Theory:

This Android tutorial will walk you through to create an alarm clock Android application. This
alarm app is planned to be minimalistic and usable. It can set alarm for one occurrence for the
coming day. You will get alarm ring sound, a notification message and a message in the app UI.
This application and device can be idle or sleeping when the alarm triggers.
We will be using the AlarmManager API to set and ring the alarm notification. We will have a
TimePicker component and a toggle switch in the UI to set the alarm time.

Android Alarm Clock Application


Application is planned to be simple as possible and you can use this as a base framework
and enhance it by adding fancy features.

1. Android Manifest

AndroidManifest.xml
We need to give uses-permission for WAKE_LOCK, other than that the
AndroidManifest.xml is pretty standard one. Just need to include the service and receiver.

AlarmActivity.java
AlarmActivity uses the AlarmManager to set the alarm and send notification on alarm
trigger.

3. Alarm Receiver

AlarmReceiver.java
AlarmReceiver is a WakefulBroadcasReceiver, this is the one that receives the alarm
trigger on set time. From here we initiate different actions to notify the user as per our
choice. I have given three type of notifications, first show a message to user in the
activity UI, second play the alarm ringtone and third send an Android notification
message. So this is the place to add enhancement for different types of user notifications.

61 | P a g e
4. Alarm Notification Message

AlarmService.java
The receiver will start the following IntentService to send a standard notification to the
user.

Result:____________________________________________________
______________________________________________________

Conclusion:

62 | P a g e
Questionnaire

1) What is a android alarm Manager?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

2) Name the languages supported for android development?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

3) What is a job scheduler?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

4) What is the android manifest standard?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

5) What is the need of WAKE_LOCK?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

63 | P a g e
6) What is Alarm Activity?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

7) Define package PendingIntent .

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

8) Define Time Picker package.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

9)___________________ is receives the alarm trigger on set time in alarm Receiver .

10) Explain Uri package.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

64 | P a g e
Experiment No.8

Aim: Develop an application that writes data to the SD card.

Theory:

Android external storage can be used to write and save data, read configuration files etc. This
article is continuation of the Android Internal Storage tutorial in the series of tutorials on
structured data storage in android.

Android External Storage:

External storage such as SD card can also store application data, there’s no security enforced
upon files you save to the external storage.
In general there are two types of External Storage:

 Primary External Storage: In built shared storage which is “accessible by the user by
plugging in a USB cable and mounting it as a drive on a host computer”. Example: When
we say Nexus 5 32 GB.
 Secondary External Storage: Removable storage. Example: SD Card

Methods to Store Data In Android:

 getExternalStorageDirectory() – Older way to access external storage in API Level


 less than 7. It is absolute now and not recommended. It directly get the reference to the
root directory of your external storage or SD Card.
 getExternalFilesDir(String type) – It is recommended way to enable us to create private
files specific to app and files are removed as app is uninstalled. Example is app private
data.
 getExternalStoragePublicDirectory() : This is current recommended way that enable us
to keep files public and are not deleted with the app uninstallation. Example images
clicked by the camera exists even we uninstall the camera app.

All applications can read and write files placed on the external storage and the user can remove
them. We need to check if the SD card is available and if we can write to it. Once we’ve checked
that the external storage is available only then we can write to it else the save button would be
disabled.

65 | P a g e
Steps to Create application:

 Open android studio and create new project

 Select our project in the project explorer

 Go to res folder and select layout Double click the main xml file

 Type the code for main.xml or drag and drop various components used in our program

 Drag and drop relative layout and change its properties

 Drag and drop image view and change its properties according to our programs

 Screen layout can be viewed by clicking graphics layout tab

 Include necessary files

 Override OnCreate() function

 Create Image view and initialize its using id of some components used in the xml program

 Save the program

 Run the program

 Output can be viewed in the android emulator.

Result:____________________________________________________
__________________________________________________________

Conclusion:

66 | P a g e
Questionnaire

1) How Do I Switch From Internal Storage to SD Card?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

2) what is the use of getExternalFilesDir() method in android ?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

3) What is?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

4) What is the?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

5) What is the?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

67 | P a g e
6) What is?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

7) Define.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

8) Define

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

9)___________________ is receives the alarm trigger on set time in alarm Receiver .

10) Explain

---------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
---------------------------

68 | P a g e
Experiment No.9

Aim: To develop a Android Application that creates an alert upon receiving a message.

Theory
Procedure:
Creating a New project:

 Open Android Studio and then click on File -> New -> New project.

 Then type the Application name as “ex.no.10″ and click Next.

69 | P a g e
 Then select the Minimum SDK as shown below and click Next.

 Then select the Empty Activity and click Next.


 Finally click Finish.

70 | P a g e
 Finally click Finish.

 It will take some time to build and load the project.


 After completion it will look as given below.

71 | P a g e
Steps for Creating Second Activity for the Android Application:

 Click on File -> New -> Activity -> Empty Activity.


 Type the Activity Name as SecondActivity and click Finish button.
 Thus Second Activity For the application is created.

Designing layout for the Android Application:

 Click on app -> res -> layout -> activity_main.xml.


 Now click on Text and then delete the code which is there and type the code.

Result:____________________________________________________
__________________________________________________________

Conclusion:

72 | P a g e
Questionnaire

1)What is a notification ?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

2) What are the android alert Dialog components?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

3) List out alert dialog Functions ?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

4) What is the notification builder in android ?

----------------------------------------- ---------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
-

5) How to display an alert dialog on Android?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

73 | P a g e
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

6) What is Alarm Activity?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

7) Define package PendingIntent .

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

8) Define Time Picker package.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

9)___________________ is receives the alarm trigger on set time in alarm Receiver .

10) Explain Uri package.

---------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
---------------------------

74 | P a g e
Experiment No.10

Aim: Write an application that draws basic graphical primitives on the screen.

Theory

Procedure:

Creating a New project:

 Open Android Studio and then click on File -> New -> New project.

 Then type the Application name as “ex.no.4″ and click Next.

75 | P a g e
 Then select the Minimum SDK as shown below and click Next.

76 | P a g e
 Then select the Empty Activity and click Next.

 Finally click Finish.

77 | P a g e
 It will take some time to build and load the project.
 After completion it will look as given below.

Designing layout for the Android Application:

 Click on app -> res -> layout -> activity_main.xml.

 Now click on Text and then delete the code which is there and type the your code.
 Now click on Design and your application will look as given below.

78 | P a g e

 So now the designing part is completed.

Java Coding for the Android Application:

 Click on app -> java -> com.example.exno4 -> MainActivity.


 Then delete the code which is there and type your code.
 So now the Coding part is also completed.
 Now run the application to see the output.

Result:____________________________________________________
______________________________________________________

Conclusion:

79 | P a g e
Questionnaire

1) What is a android.graphics.Paint?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

2) What is the function of this key GFX_LINE_STYLE_THICK_SOLID ?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

3) List out setup functions for graphics primitives?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

4) ) List out Drawing functions for graphics primitives ?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

5) What is a Graphics Primitives?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

80 | P a g e
6) What is Alarm Activity?

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

7) Define package PendingIntent .

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

8) Define Time Picker package.

---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------

9)___________________ is receives the alarm trigger on set time in alarm Receiver .

10) Explain Uri package.

---------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
---------------------------

81 | P a g e

You might also like