IT3681MOBILE APPLICATIONS DEVELOPMENT LABORATORY Manual
IT3681MOBILE APPLICATIONS DEVELOPMENT LABORATORY Manual
Lesson Plan
VISION
To produce competent IT professionals offering quality technical education to meet industrial and societal
needs.
MISSION
1. To provide academic excellence and inculcate the spirit of professionalism.
2. To empower students with research and entrepreneurial capabilities for addressing societal problems.
3. To establish collaboration with industries for technology transfer.
4. To promote continuous learning and nurture creativity skills with strong ethical values.
PROGRAM EDUCATIONAL OBJECTIVES (PEOs)
1. Demonstrate technical competence with analytical and critical thinking to understand and meet the diversified
requirements of industry, academia and research.
2. Exhibit technical leadership, team skills and entrepreneurship skills to provide business solutions to real world
problems.
3. Work in multi-disciplinary industries with social and environmental responsibility, work ethics and adaptability
to address complex engineering and social problems.
4. Pursue lifelong learning, use cutting edge technologies and involve in applied research to design optimal
solutions.
.
IT3681 MOBILE APPLICATIONS DEVELOPMENT LABORATORY
COURSE OBJECTIVES:
The objective of this course is to enable the students to
● Use Flutter/Kotlin multi-platform environment for building
cross platform mobile applications.
● Demonstrate the knowledge of different programming techniques
and patterns for mobile application development.
● Identify the components and structure of mobile application development frameworks.
● Understand the capabilities and limitations of different platforms.
● Design and develop real-time mobile applications.
LIST OF EXPERIMENTS:
● Study and installation of Flutter/Kotlin multi-platform environment
● Develop an application that uses Widgets, GUI components, Fonts, and Colors.
● Develop a native calculator application.
● Develop a gaming application that uses 2-D animations and gestures.
● Develop a movie rating application (similar to IMDB)
● Develop an application to connect to a web service and to retrieve data with HTTP.
● Develop a simple shopping application.
● Design a web server supporting push notifications.
● Develop an application by integrating Google maps
● Mini Projects involving Flutter/Kotlin multi-platform
TEXTBOOKS:
1. Simone Alessandria, Flutter Projects: A practical project-based guide to
building real-world cross-platform mobile applications and games, Packt
publishing.
2. Carmine Zaccagnino, Programming Flutter: Native, Cross-Platform
Apps the Easy Way (The Pragmatic Programmers), Packt publishing.
REFERENCES
1. Gergely Orosz, Building Mobile Applications at Scale:39 Engineering Challenges
2. Souvik Biswas & Codemagic, Flutter Libraries we love
3. ED Freitas, Daniel Jebaraj, Flutter Succinctly
4. Antonio Leiva, Kotlin for Android Developers Learn Kotlin the easy way while
developing an Android Applications
COURSE OUTCOMES:
On successful completion of this course, the student should be able to
CO1:Design and build simple mobile applications supporting multiple
platforms.
CO2:Apply various programming techniques and patterns to build
mobile applications.
CO3:Build real-time mobile applications for society/environment
CO4:Build gaming and multimedia based mobile applications
CO5:Build AI based mobile applications for society/environment following ethical practices
TABLE OF CONTENTS
Ex. Teaching
No.of
No Topics to be covered Method
Periods
. Followed
1 Study and installation of Flutter/Kotlin multi-platform environment 5 GTM
4 Develop a gaming application that uses 2-D animations and gestures 6 GTM
Develop a movie rating application (similar to IMDB) 6
5 GTM
Introduction
In general, developing a mobile application is a complex and challenging task. There are many frameworks
available to develop a mobile application. Android provides a native framework based on Java language and iOS
provides a native framework based on Objective-C / Swift language.
However, to develop an application supporting both the OSs, we need to code in two different languages using
two different frameworks. To help overcome this complexity, there exists mobile frameworks supporting both
OS. These frameworks range from simple HTML based hybrid mobile application framework (which uses
HTML for User Interface and JavaScript for application logic) to complex language specific framework (which
do the heavy lifting of converting code to native code). Irrespective of their simplicity or complexity, these
frameworks always have many disadvantages, one of the main drawback being their slow performance.
In this scenario, Flutter – a simple and high performance framework based on Dart language, provides high
performance by rendering the UI directly in the operating system’s canvas rather than through native framework.
Flutter also offers many ready to use widgets (UI) to create a modern application. These widgets are optimized
for mobile environment and designing the application using widgets is as simple as designing HTML.
To be specific, Flutter application is itself a widget. Flutter widgets also supports animations and gestures. The
application logic is based on reactive programming. Widget may optionally have a state. By changing the state of
the widget, Flutter will automatically (reactive programming) compare the widget’s state (old and new) and
render the widget with only the necessary changes instead of re-rendering the whole widget.
Features of Flutter
Installation in Windows
In this section, let us see how to install Flutter SDK and its requirement in a windows system.
Step 5 − Running the above command will analyze the system and show its report as shown below −
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows
[Version 10.0.17134.706], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK
version 28.0.3)
[√] Android Studio (version 3.2)
[√] VS Code, 64-bit edition (version
1.29.1) [!] Connected device
! No devices available
! Doctor found issues in 1 category.
The report says that all development tools are available but the device is not connected. We can fix
this by connecting an android device through USB or starting an android emulator.
Step 8 − Start an android emulator or connect a real android device to the system.
Step 9 − Install Flutter and Dart plugin for Android Studio. It provides startup template to create new Flutter
application, an option to run and debug Flutter application in the Android studio itself, etc.,
Installation in MacOS
To install Flutter on MacOS, you will have to follow the following steps −
Step 3 − Update the system path to include flutter bin directory (in ~/.bashrc file).
Step 4 − Enable the updated path in the current session using below command and then verify it as well.
source ~/.bashrc
source $HOME/.bash_profile echo $PATH
Flutter provides a tool, flutter doctor to check that all the requirement of flutter development is met. It is
similar to the Windows counterpart.
Step 8 − Start an android emulator or connect a real android device to the system to develop android application.
Step 9 − Open iOS simulator or connect a real iPhone device to the system to develop iOS application.
Step 10 − Install Flutter and Dart plugin for Android Studio. It provides the startup template to create a new
Flutter application, option to run and debug Flutter application in the Android studio itself, etc.,
Result:
Thus, installation of Flutter/Kotlin multi-platform environment successfully completed.
Ex.No:2 Develop an application that uses Widgets, GUI components, Fonts, and Colors.
Aim:
To develop a Simple Android Application that uses GUI components, Font and Colors.
Procedure:
▪ Open Android Stdio and then click on File -> New -> New project.
▪ Then select the Minimum SDK as shown below and click Next.
▪ Then select the Empty Activity and click Next.
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:gravity="center"
android:text="Hello World!"
android:textSize="25sp"
android:textStyle="bold" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:gravity="center"
android:text="Change font size"
android:textSize="25sp" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:gravity="center"
android:text="Change color"
android:textSize="25sp" />
</LinearLayout>
▪ Now click on Design and your application will look as given below.
▪ So now the designing part is
completed. Java Coding for the Android
Application:
▪ Then delete the code which is there and type the code as given below.
Code for MainActivity.java:
?
package com.example.exno1;
import android.graphics.Color;
import
android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import
android.widget.Button;
import
android.widget.TextView;
Thus a Simple Android Application that uses GUI components, Font and Colors is developed and
executed successfully.
Ex.No:3 Develop a native calculator application.
Aim:
Procedure:
▪ Open Android Stdio and then click on File -> New -> New project.
▪ Then select the Minimum SDK as shown below and click Next.
▪ Then select the Empty Activity and click Next.
▪ Then delete the code which is there and type the code as given below.
Code for MainActivity.java:
?
package com.example.devang.exno3;
import android.os.Bundle;
import
android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import
android.view.View.OnClickListener;
import android.widget.Button;
import
android.widget.EditText;
import
android.widget.TextView;
Button Sub;
Button Mul;
Button Div;
TextView Result;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// set a listener
Add.setOnClickListener(this);
Sub.setOnClickListener(this);
Mul.setOnClickListener(this);
Div.setOnClickListener(this);
}
@Override
public void onClick (View v)
{
flo num1 = 0;
at num2 = 0;
flo result = 0;
at
flo
at
String oper = "";
// defines the button that has been clicked and performs the corresponding operation
// write operation into oper, we will use it later for output
switch (v.getId())
{
case R.id.Add:
oper = "+";
result = num1 + num2;
break;
case R.id.Sub:
oper = "-";
result = num1 - num2;
break;
case R.id.Mul:
oper = "*";
result = num1 * num2;
break;
case R.id.Div:
oper = "/";
result = num1 / num2;
break;
default:
break;
}
// form the output line
Result.setText(num1 + " " + oper + " " + num2 + " = " + result);
}
}
▪ So now the Coding part is also completed.
▪ Now run the application to see the output.
Output:
Result:
Thus a Simple Android Application for Native Calculator is developed and executed successfully.
Ex.No:4 Develop a gaming application that uses 2-D animations and gestures Aim:
To develop a gaming application that uses 2-D animations and gestures
Aim:
To Develop a gaming application that uses 2-D animations and gestures.
Program :
activity_main.xml:
ball.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FF5722"/>
<corners android:radius="50dp"/>
</shape>
MainActivity.java:
package com.example.simplegame;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
private TextView scoreText;
private TextView timerText;
private View ball;
private int score = 0;
private int timeRemaining = 30;
private boolean isGameRunning = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
scoreText = findViewById(R.id.scoreText);
timerText = findViewById(R.id.timerText);
ball = findViewById(R.id.ball);
startGameTimer();
ball.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isGameRunning) {
score++;
scoreText.setText("Score: " + score);
moveBall();
}
}
});
}
private void startGameTimer() {
final Handler handler = new Handler();
Runnable timerRunnable = new Runnable() {
@Override
public void run() {
if (timeRemaining > 0) {
timeRemaining--;
timerText.setText("Time: " + timeRemaining);
handler.postDelayed(this, 1000); // Update every second
} else {
endGame();
}
}
};
handler.post(timerRunnable);
}
private void moveBall() {
int screenWidth = getResources().getDisplayMetrics().widthPixels;
int screenHeight = getResources().getDisplayMetrics().heightPixels;
Random random = new Random();
int x = random.nextInt(screenWidth - ball.getWidth());
int y = random.nextInt(screenHeight - ball.getHeight());
ball.setX(x);
ball.setY(y);
}
private void endGame() {
isGameRunning = false;
Toast.makeText(this, "Game Over! Final Score: " + score, Toast.LENGTH_SHORT).show();
}
}
OUTPUT:
Result:
Successfully Develop a gaming application that uses 2-D animations and gestures
Ex.No: 5 Develop a movie rating application (similar to
IMDB) Aim:
To develop a movie rating application.
Procedure:
MainActivity.java
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Choose one of the following modes"
android:textAppearance="?android:attr/textAppearanceLarge" />
<RadioGroup
android:id="@+id/myRadioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_marginLeft="27dp"
android:layout_marginTop="28dp">
<RadioButton
android:id="@+id/sound"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Sound" />
<RadioButton
android:id="@+id/vibrate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Vibration" />
<RadioButton
android:id="@+id/silent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Silent" />
</RadioGroup>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/myRadioGroup"
android:layout_below="@+id/myRadioGroup"
android:layout_marginLeft="42dp"
android:layout_marginTop="53dp"
android:text="choose" />
</RelativeLayout>
package com.example.myapplication;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// find which radio button is selected
if (checkedId == R.id.silent) {
Toast.makeText(getApplicationContext(), "choice: Silent", Toast.LENGTH_SHORT).show();
} else if (checkedId == R.id.sound) {
Toast.makeText(getApplicationContext(), "choice: Sound", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "choice: Vibration", Toast.LENGTH_SHORT).show();
}
}
});
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
int selectedId = radioGroup.getCheckedRadioButtonId();
OUTPUT:
Result:
Thus, the program was executed and implemented successfully.
Ex.No: 6 Develop an application to connect to a web service and to retrieve data
with HTTP
Aim:
To develop an application to connect to a web service and to retrieve data with
HTTP
Algorithm:
Program Code:
Mainactivity.Java
package com.example.admin.myapplication;
import
android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import
android.view.View;
import
android.widget.Button;
import
android.widget.Toast;
AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button startBtn = (Button) findViewById(R.id.sendbttn);
startBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
sendEmail();
}
});
}
"muthuramalingam566@gmail.com"
};
String[] CC = {
"ramdurai25@gmail.com"
};
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_CC, CC);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Email message goes here");
try {
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
Log.i("Finished sending email...", "");
} catch (android.content.ActivityNotFoundException ex)
{ Toast.makeText(MainActivity.this, "There is no email client
installed.", Toast.LENGTH_SHORT).show();
}
}
}
activity_main.xml
android:id="@+id/editText"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10" android:id="@+id/editText2"
android:layout_below="@+id/editText"
android:layout_alignRight="@+id/editText"
android:layout_alignEnd="@+id/editText" />
<EditText android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10" android:id="@+id/editText3"
android:layout_below="@+id/editText2"
android:layout_alignRight="@+id/editText2"
android:layout_alignEnd="@+id/editText2" />
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SEND MAIL"
android:id="@+id/sendbttn"
android:layout_centerVertical="true"
android:layout_alignLeft="@+id/editText3"
android:layout_alignStart="@+id/editText3" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recipient"
android:id="@+id/textView"
android:layout_alignBottom="@+id/editText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="subject"
android:id="@+id/textView2"
android:layout_alignBottom="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Message Body"
android:id="@+id/textView3"
android:layout_alignBottom="@+id/editText3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
OUTPUT:
Result:
Thus, the program was implemented and executed successfully.
Ex.No: 7 Develop a simple shopping
application Aim:
To develop a simple shopping application
Procedure:
MainActivity.java
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello_world" />
<Button
android:id="@+id/item1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="299dp"
android:layout_marginEnd="120dp"
android:text="Item 1" />
<Button
android:id="@+id/item2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/item1"
android:layout_alignParentEnd="true"
android:layout_marginTop="12dp"
android:layout_marginEnd="128dp"
android:text="Item 2" />
<Button
android:id="@+id/item3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="98dp"
android:layout_marginBottom="146dp"
android:text="Item 3" />
</RelativeLayout>
package com.example.optionmenue;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Action to perform when button2 is clicked
Toast.makeText(MainActivity.this, "Button 2 clicked", Toast.LENGTH_SHORT).show();
}
});
button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Action to perform when button3 is clicked
Toast.makeText(MainActivity.this, "Button 3 clicked", Toast.LENGTH_SHORT).show();
}
});
}
}
OUTPUT:
Result:
Thus, the program was implemented and executed successfully
Ex.No: 8 Design a web server supporting push notifications.
Aim:
To develop a web server supporting push notifications.
Algorithm:
1. Create a New Android Project:
● Click New in the toolbar.
● In the window that appears, open the Android folder, select Android Application
Project, and click next.
● Provide the application name and the project name and then finally give the
desired package name.
● Choose a launcher icon for your application and then select Blank Activity and then
click Next
● Provide the desired Activity name for your project and then click Finish.
2. Create a New AVD (Android Virtual Device):
● click Android Virtual Device Manager from the toolbar.
● In the Android Virtual Device Manager panel, click New.
● Fill in the details for the AVD. Give it a name, a platform target, an SD card size,
and a skin (HVGA is default).
● Click Create AVD and Select the new AVD from the Android Virtual
Device Manager and click Start.
3. Design the layout by adding a text box and a command button.
4. Run the application.
5. If the entered E-mail doesn’t match the given E-mail id, then an alert will be displayed.
6. If the entered E-mail id matches with the provided mail-id then login is successful.
7. Close the Android project.
PROGRAM CODE:
MainActivity.java
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical" >
<EditText
android:id="@+id/emailInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<Button
android:id="@+id/btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20sp"
android:gravity="center"
android:text="Login" />
</LinearLayout>
package com.example.alert;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BTN.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String val = email.getText().toString();
if (val == null || val.length() <= 0) {
Toast.makeText(getApplicationContext(),
"Please Enter the email", Toast.LENGTH_LONG).show();
} else if (val.equals("enpboss@gmail.com")) {
Intent intent = new Intent(getApplicationContext(),second_activity.class);
startActivity(intent);
Toast.makeText(getApplicationContext(), "Login Success", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "Please Enter valid email",
Toast.LENGTH_LONG).show();
}
}
});
}
}
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Alert"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</manifest>
OUTPUT:
Result:
Thus, the program was implemented and executed successfully.
Ex.No: 9 Develop an application by integrating Google maps
AIM:
To develop an android application that uses Google Map location information.
ALGORITHM:
PROGRAM CODE
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Emergency Alert System" />
<EditText
android:id="@+id/editTextSMS"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="top" />
<EditText
android:id="@+id/textlon"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="top" />
<Button
android:id="@+id/buttonSend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send" />
</LinearLayout>
package com.example.emergency;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.core.app.ActivityCompat;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@Override
public void onProviderDisabled(String provider) {
Toast.makeText(getApplicationContext(), "Gps Disabled", Toast.LENGTH_SHORT).show();
}
@Override
public void onProviderEnabled(String provider) {
Toast.makeText(getApplicationContext(), "Gps Enabled", Toast.LENGTH_SHORT).show();
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// Not implemented, but required to override abstract method
}
}
}
OUTPUT:
Result:
Thus, the program for android application that makes use of Google Map was
executed successfully.
Ex.No: 10 Mini Projects involving Flutter/Kotlin multi-
platform AIM:
PROCEDURE:
FileName :MainActivity.java
Package
com.lab.alarmclock;
import
java.util.Calendar;
import
android.app.Activity;
import
android.app.AlarmManager;
import
android.app.PendingIntent;
import
android.content.Context;
import
android.content.Intent;
import android.os.Bundle;
import android.view.View;
import
android.view.View.OnClickListe
ner; import
android.widget.Button; import
android.widget.TimePicker;
private TimePicker
timepicker; private
Context context; private
Button btnSetAlarm;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
context = this;
btnSetAlarm = (Button)
findViewById(R.id.btnSetAlarm);
btnSetAlarm.setOnClickListener(new
OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,
timepicker.getCurrentHour());
calendar.set(Calendar.MINUTE,
timepicker.getCurrentMinute());
AlarmManager
alarmManager = (AlarmManager)
getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC,
calendar.getTimeInMillis(), pendingIntent);
}
});
};}
}
package com.lab.alarmclock;
import
android.content.Context;
import
android.content.Intent;
import
android.media.Ringtone;
import
android.media.RingtoneManager
; import android.net.Uri;
import
android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import android.widget.Toast;
extends
WakefulBroadcastReceiver { @Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Log.e("alarmreceiver", "alarmreceiver");
Toast.makeText(context, "alarmreceiver", Toast.LENGTH_LONG).show();
alarmUri); ringtone.play();
}
}
</manifest>
OUTPUT:
RESULT: