You are on page 1of 26

TRAINING REPORT

ON

Weather App Development

Submitted in partial fulfillment of the requirements for the award of the degree of

Bachelor of Technology

IN

Computer Science & Engineering

BY

SAHIL GOYAL

(20255302717)

(CSE/17/262)

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


Under the guidance of

Mr .YOGEN P. ( Kyrion Technology Pvt Ltd)

B.M. INSTITUTE OF ENGINEERING & TECHNOLOGY


AFFILIATED TO GGSIPU, DWARKA

SUBMITTED TO- MR.VIKAS KUCHHAL


(ASST. PROFESSOR CSE DEPARTMENT)
DECLARATION

I, Sahil Goyal student of B. Tech.(CSE) hereby declare that the in-house project report titled
“Weather App” which is submitted by me to Department of Computer Science &Engineering,
B.M. Institute Of Engineering & Technology, Affiliated to GGSIPU, Dwarka in partial
fulfilment of requirement for the award of the degree of Master of Technology in Computer
Science & Engineering has not been previously formed the basis for the award of any degree
,diploma or other similar title or recognition.

Date: 15 july, 2019

SAHIL GOYAL

(20255302717)

(CSE/17/262)

I
CERTIFICATION

On the basis of declaration submitted by Sahil Goyal , student of B .Tech. CSE, I hereby certify
that the in-house project titled “Weather App Development”, submitted to Department of
Computer Science & Engineering ,B.M. Institute Of Engineering & Technology, Affiliated to
GGSIPU , Dwarka in partial fulfillment of the requirement for the award of the degree of
Bachelor of Technology in Computer Science & Engineering ,is an original contribution with
existing knowledge and faithful record of work carried out by him under my guidance and
supervision.

Date: 15 july,2019 Mr. YOGEN P.


Android App Developer

Kyrion Technologies Pvt Ltd

II
ACKNOWLEDGEMENT

The key elements concentration, dedication, hard work and application are not only essential
factors for achieving the desired goals but also guidance, assistance and co-operation of people is
necessary.

I am grateful to my company guide Mr. Yogen P, Android App Developer , Kyrion


Technologies Pvt Ltd for guiding me. He has the qualities to be an ideal guide. He will always
prevail upon my remembrance.

I am also grateful to our respectful Manager Ms. Akansha Jain, Kyrion Technologies Pvt Ltd
for their regular encouragement and endeavors.

I am very fortunate to have unconditional support from my family. I thank my parents, who gave
me the courage to get my education, supported me in all achievements throughout my life.
Without their encouragement, this work would indeed have been very difficult for me to tackle.
Above all, I pay my reverence to the almighty GOD.

SAHIL GOYAL
(20255302717)
(CSE/17/262)

III
ABSTRACT

Android is a software platform and operating system for mobile devices based on the Linux
operating system and developed by Google and the Open Handset Alliance. It lets developers
create a friendly and easily comprehensible code in a Java-like language that consumes Google-
developed Java libraries, but does not give provision for developing programs in native code.
Android offers a rich application framework that enables us to construct ground-breaking apps
and games for mobile devices in an environment of Java language.As we are living in tech-savvy
world, the project “Clima” is a small attempt based on the idea of weather and temperature
model. One of the best tools you can have when the weather's about to turn nasty is right there in
your pocket. Your smartphone can keep you up-to-date on severe weather conditions. Knowing
the weather is something that we all pretty much need to know. Smartphone weather apps and
weather widgets have been steadily improving over the years. They work better, have more
detailed and accurate information, and the weather widgets look better with whatever theme you
happen to be using. Here are the best weather apps and weather widgets currently available on
Android.This project has great impact on lives of people, since in this fast-paced era everybody
has a hectic schedule and they can now check the weather and temperature of any city on the app
with the help of just few clicks. This initiative is an attempt to make the life of the people
smoother and convenient by providing them best of the services in their palms.

IV
TABLE OF CONTENTS

I. Declaration i
II. Certificate ii
III. Acknowledgement iii
IV. Abstract iv

1 Introduction 1

2 Material and Methods

2.1 Software used for APP Development 1


2.2 API 1
2.3 Manifest 1
2.4 Using Location Manager 3
2.5 Making HTTP Request 3
2.6 JSON Format 5
2.7 JSON Parsing 6
2.8 Layout 7
2.9 Updating UI 8
2.10 New Activity for Weather data for other cities 9
2.11 Intent 10
2.12 API Call with City Name 10
2.13 Mipmap 10
2.14 Gradle 10
3 Results and Discussion 16
4 Conclusion and Recommendation 17
5 Implications for Fututre Use 18
6 References 19
1. INTRODUCTION

Clima is an application written in JAVA which is based on a weather model. It tells the weather
for the current city andthe weather for the different cities(all over the world) entered by the user.
Clima also tells the temperature for the current city as well as for the different cities (all over the
world). When the user opens the application for the first time, it asks for the location permission.
If permision is granted, then only weather and temperature for current location is displayed.
Clima app will work perfectly on API level 16 and above i.e. jellybean and above.

2. MATERIALS AND METHODS

2.1 SOFTWARE USED FOR APP DEVELOPMENT

Software used to develop the android apps is “ANDROID STUDIO”.

2.2 API

API stand for “Application Interface”. API is a set of functions and procedures allowing
the creation of applications that access the feature or data of an operating system,
application, or other services. Clima app access the weather data from a website to show
in the application.

Website used for weather data is www.openweathermap.org. The OpenWeatherMap


website provides different API’s for the weather data. API used in “Clima” app is
“Current Weather Data”. This API access current weather data for any location over
200,000 cities. Current weather data is frequently updated based on global models and
data from more than 40,000 weather stations. Data is available in JSON, XML or HTML
format. The documentation of this API is provided on the open weather map website.

2.3 MANIFEST

Every project in Android includes a manifest file, which is AndroidManifest.xml, stored


in the root directory of its project hierarchy. The manifest file is an important part of our

1
app because it defines the structure and metadata of our application, its components, and
its requirements.

This file includes nodes for each of the Activities, Services, Content Providers and
Broadcast Receiver that make the application and using Intent Filters and Permissions,
determines how they co-ordinate with each other and other applications.

The manifest file also specifies the application metadata, which includes its icon, version
number, themes etc. and additional top- level nodes can specify any required permissions,
unit tests and define hardware, screen, or platform requirements.

The manifest comprises of a root manifest tag with a package attribute set to the project’s
package. It should also include an xmls:android attribute that will supply several system
attributes used within the file.

The Manifest file of the Clima app is :

2
In manifest file we have asked the user for the internet and location persmission.

2.4 USING LOCATION MANAGER

The location manager is used to get the current latitude and longitude of the device in
which Clima app is installer. The location manager is a feature of android studio which
helps in achieving it.

2.5 MAKING HTTP REQUEST

There are two types of HTTP request- “GET” request and “POST” Request. Get request
is used to retrieve data from the web where as POST request is used to send the data on
the web. Clima app uses Get request to retrieve the weather data from the open weather
map website. Clima app uses an external library for making GET request. Clima app uses
Asynchronus HTTP request. In Asynchronus HTTP request, all requests are made outside
of the Clima’s main UI thread. The name of the external library that Clima uses is “James
Smith Library”. To add this library in the project we need to add the dependency to our
gradle file (format is given on the website). To get the weather data for current we need
to call the URL: “www.api.openweathermap.org/data/2.5/weather” with the following
parameters:

1. lat: latitude of the current location


2. long: longitude of the current location
3. app id: it is a unique key which is given by open weather map for api calls. It is
mandatory to pass this API key as a parameter.

3
After the successful call back the weather data is returned in JSON format. The following
is the method for HTTP request.

4
2.6 JSON FORMAT

JSON stand for Java Script Object Notation. JSON is syntax for storing and exchanging
data. Since JSON format is text only, it can easily be sent to and from a server, and used
as data format by any programming language.

After the successful call back the weather data in JSON format is need to be parsed. The
Following is the weather data in JSON format after the successful call back:

5
2.7 JSON PARSING

Parsing JSON means interpreting the data with whatever language we are using at the
moment. In Clima app the data is taken out from JSON and put it in Java object to make
it useable. Here James Smith Library comes into play as it helps in JSON parsing by
creating Json object to get the particular field. JSON parsing may ecounter errors so to
avoid the errors in json parsing, it must be in try catch block. The following is the code
for the json parsing:

6
2.8 LAYOUT

Layouts are the XML files which are designed for the UI. There are two XML files in the
Clima Application. Each and every file must be linked with the java file. The following is
the syntax to link the java the file with the XML file: setContentView(R.layout.”XML
file name”). The following are the XML files used in Clima Application:

7
2.9 UPDATING THE UI

set text method is used to update the UI in the Clima app. To update the UI getter
methods are defined to get the data that is parsed. UI is nothing but set of images. Images
are stored in drawable folder. To set the image as Image view we need to use the images
resource id.

8
2.10 NEW ACTIVITY FOR WEATHER DATA FOR OTHER CITIES(all over the
world):

There is an edit text where user can enter the city name and a back controller to go back
to the curent location activity. For going back to the current location activity, intent is
used.

9
2.11 INTENT

An intent is an abstract description of an operation to be performed. An intent provides a


facility fro performing late run time binding between the codes in different applications.
Its most significant use is in the launching of activities, where it can be thought of as the
glue between activites. It is basically a passive data structure holding an abstract
description of an action to be performed.

2.12 API CALL WITH CITY NAME

When a user enters the city name, the city name must be updated before calling the
weather data API for the updated city name. after the successful call back weather for the
entered city name is shown.

2.13 MIPMAP

Devices have different resolutions so the launcher app show icons on different
resolutions. When the launcher app has to upscale a lower resolution icon for display it
might look blurred. To avoid this issue, applications should use the mipmap drawable
folders for app launcher icons. There are 5 mipmap drawable folders: mdpi, hdpi, xhdpi,
xxhdpi, xxxhdpi.

2.14 GRADLE

Gradle is a build system (open source) which is used to automate building, testing,
deployment etc. “Build.gradle” are scripts where one can automate the task. Every

10
Android project needs a gradle for generating an apk from the .java and .xml files in the
project. A gradle takes all the source files (JAVA and XML) and apply appropriate tools,

e.g. converts the java files into dex files and compresses all of them into a single file
known as apk that is actually used.

There are two types of build.gradle scripts:

1. Top-level build.gradle: It is located in the root project directory and its main
function is to define the build configurations that will be applied to all the
modules in the project. It is implemented as :
buildscript
{
repositories
{
google()
jcenter()
}
dependencies
{
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects
{
repositories
{
google()
jcenter()
}
}

11
task clean(type
: Delete)
{
delete rootProject.buildDir
}

The top-level build.gradle supports various build configuration like:

 buildscript- This block is used to configure the repositories and


dependencies for Gradle.
 allprojects- This is the block where one can configure the third-
party plugins or libraries. For freshly created projects android
studio includes JCenter and Google’s maven repository by default.
 Task clean: This block is used to delete the directory everytime the
project is run. This way the projects keep clean when someone
modify some config files like, during settings.gradle which require
a complete clean.
2. Module-level build.gradle:This gradle script is where all the dependencies are
defined and where the sdk versions are declared. This scripts has many functions
in the project which includes additional build types and override settings in the
manifest file or build.gradle file. It is implemented as:

apply plugin : 'com.android.application'


android
{
compileSdkVersion 26 defaultConfig
{
applicationId "example.mehakmeet.geeksforgeeks"
minSdkVersion 19
targetSdkVersion 26
versionCode 1

12
versionName "1.0"
}
buildTypes
{
release

{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-
android.txt'), 'proguard-rules.pro'
}
}
}

dependencies
{
implementation fileTree(include : [ '*.jar' ], dir : 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
}

The Module-level build.gradle supports various build configurations like:


1) Android: this block is used for configuring the specific android
options.
 compileSDKVersion - This used to define the API level of
the app and the app can use the features of this and lowe
level
2) defaultConfig:
 applicationId – This is used for identifying the unique id
for publishing the app.

13
 minSDKVersion – This defines the minimum API level
used to test the app.
 versionCode – This defines the API version code of the
app. Everytime an update needs to be of the app, the
version code needds to be ncreased by 1 or more.
 versionName – This defines the version name for the app.
This could be increased by any much while creating an-
update
3) buildTypes(release)
 minifyEnabled – This will enable code shrinking in
realease build
 proguaredFiles – This will specify the proguard setting file.
4) dependencies – This specify the dependencies that are needed to build
the project.

Both the top-level and module-level buld.gradle files are the main script files for
automating the tasks in adroid project and are used by the gradle for generating the APK
from the source files.

14
15
3. RESULTS AND DISCUSSION

Following is the result of the clima app:

16
There are apps which tells the weather forecast for the current location and doesn’t tell
the temp and weather for other cities. Moreover most of the apps are paid but Clima app
is free. other weather relatedd apps are : AccuWeather, DarkSky etc.

4. CONCLUSION AND RECOMENDATION

The present study is a contribution towards tracking the changing nature of verbal and visual
communication of weather forecasts related to the proliferation of smartphone and mobile
computing devices as means of dissemination. Most importantly, the task was to identify current
limits in order to gain potential benefits. Clima can be used to compare the weather conditions
for the two cities as well. On creating Clima project, there are three main findings:

1. What is API and how to call different API’s .


2. How to make HTTP request and get the data from the web.
3. How to parse the data on successful call back.

17
5. IMPLICATIONS FOR FUTUTRE USE

Clima app can be very useful in dfferent fields and day to day life as well. People who loves to
travel can use this app to check the weather conditions of the city they are travelling to. The
current and future advantages from revolutions in mobile communication technologies are clear,
not only for emergency weather situations, but also for ordinary forecast dissemination.
However, a few elements arising from this analysis of weather apps should be considered
carefully, because they seem to accustom users to expectations beyond current forecasting
capabilities.

18
6. REFERENCES-

[1] www.openweathermap.org

[2] www.geeksforgeeks.com

[3] www.developer.android.com

[4] www.udemy.com

[5] www.stackoverflow.com

[6] www.youtube.com

19
CD

20

You might also like