SlideShare a Scribd company logo
Expe-7
Develop a native application that
uses GPS location information
Android location APIs make it easy for you to build location-
aware applications, without needing to focus on the details of
the underlying location technology.
The Location Object
The Location object represents a geographic location
which can consist of a latitude, longitude, time stamp,
and other information such as bearing, altitude and
velocity. There are following important methods which
you can use with Location object to get location specific
information −
Sr.No. Method & Description
1 float distanceTo(Location dest)
Returns the approximate distance in meters between this location and the given location.
2 float getAccuracy()
Get the estimated accuracy of this location, in meters.
3 double getAltitude()
Get the altitude if available, in meters above sea level.
4 float getBearing()
Get the bearing, in degrees.
5 double getLatitude()
Get the latitude, in degrees.
6 double getLongitude()
Get the longitude, in degrees.
7 float getSpeed()
Get the speed if it is available, in meters/second over ground.
8 boolean hasAccuracy()
True if this location has an accuracy.
9 boolean hasAltitude()
True if this location has an altitude.
10 boolean hasBearing()
True if this location has a bearing.
11 boolean hasSpeed()
True if this location has a speed.
12 void reset()
Clears the contents of the location.
13 void setAccuracy(float accuracy)
Set the estimated accuracy of this location, meters.
14 void setAltitude(double altitude)
Set the altitude, in meters above sea level.
15 void setBearing(float bearing)
Set the bearing, in degrees.
16 void setLatitude(double latitude)
Set the latitude, in degrees.
17 void setLongitude(double longitude)
Set the longitude, in degrees.
Get the Current Location
 To get the current location, create a location client
which is LocationClient object, connect it to Location
Services using connect() method, and then call
its getLastLocation() method. This method returns
the most recent location in the form
of Location object that contains latitude and longitude
coordinates and other information as explained
above. To have location based functionality in your
activity, you will have to implement two interfaces −
 GooglePlayServicesClient.ConnectionCallbacks
 GooglePlayServicesClient.OnConnectionFailedListen
er
 These interfaces provide following important callback
methods, which you need to implement in your activity
Sr.
No.
Callback Methods & Description
1 abstract void onConnected(Bundle connectionHint)
This callback method is called when location service is connected to
the location client successfully. You will use connect() method to
connect to the location client.
2 abstract void onDisconnected()
This callback method is called when the client is disconnected. You will
use disconnect() method to disconnect from the location client.
3 abstract void onConnectionFailed(ConnectionResult result)
This callback method is called when there was an error connecting the
client to the service.
Location Quality of Service
Sr.N
o.
Method & Description
1 setExpirationDuration(long millis)
Set the duration of this request, in milliseconds.
2 setExpirationTime(long millis)
Set the request expiration time, in millisecond since boot.
3 setFastestInterval(long millis)
Explicitly set the fastest interval for location updates, in milliseconds.
4 setInterval(long millis)
Set the desired interval for active location updates, in milliseconds.
5 setNumUpdates(int numUpdates)
Set the number of location updates.
6 setPriority(int priority)
Set the priority of the request.
Create Android Application
Step Description
1 You will use Android studio IDE to create an Android
application
2 add src/GPSTracker.java file and add required code.
3 Modify src/MainActivity.java file and add required code as
shown below to take care of getting current location and its
equivalent address.
4 Modify layout XML file res/layout/activity_main.xml to add
all GUI components which include three buttons and two
text views to show location/address.
5 Modify res/values/strings.xml to define required constant
values
6 Modify AndroidManifest.xml as shown below
7 Run the application to launch Android emulator and verify
the result of the changes done in the application.
File locations
 res/layout/activity_main.xml
 res/values/strings.xml

More Related Content

What's hot

Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAhsanul Karim
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
kumar gaurav
 
Unit 4
Unit 4Unit 4
Unit 4
Ravi Kumar
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycle
Dhruvin Nakrani
 
Sending Email
Sending EmailSending Email
Sending Email
primeteacher32
 
Mobile platforms
Mobile platformsMobile platforms
Mobile platforms
vaibhav kubadia
 
Virtualization in cloud computing
Virtualization in cloud computingVirtualization in cloud computing
Virtualization in cloud computing
Mohammad Ilyas Malik
 
Cloud computing notes
Cloud computing notesCloud computing notes
Cloud computing notes
Srinivasa Rao
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
amitksaha
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
Madishetty Prathibha
 
Java(Polymorphism)
Java(Polymorphism)Java(Polymorphism)
Java(Polymorphism)
harsh kothari
 
Ooad 2marks
Ooad 2marksOoad 2marks
Ooad 2marksAsh Wini
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Java awt (abstract window toolkit)
Java awt (abstract window toolkit)
Elizabeth alexander
 
Anatomy of android application
Anatomy of android applicationAnatomy of android application
Anatomy of android application
Nikunj Dhameliya
 
Android - Graphics Animation in Android
Android - Graphics Animation in AndroidAndroid - Graphics Animation in Android
Android - Graphics Animation in Android
Vibrant Technologies & Computers
 
Servlet life cycle
Servlet life cycleServlet life cycle
Servlet life cycle
Venkateswara Rao N
 
Ipv6 the next generation protocol
Ipv6 the next generation protocolIpv6 the next generation protocol
Ipv6 the next generation protocolPRADEEP Cheekatla
 
Vb6 vs vb.net....(visual basic) presentation
Vb6 vs vb.net....(visual basic) presentationVb6 vs vb.net....(visual basic) presentation
Vb6 vs vb.net....(visual basic) presentation
Iftikhar Ahmad
 
Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big Picture
Sriyank Siddhartha
 
Address Resolution Protocol
Address Resolution ProtocolAddress Resolution Protocol
Address Resolution Protocol
Ram Dutt Shukla
 

What's hot (20)

Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
 
Unit 4
Unit 4Unit 4
Unit 4
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycle
 
Sending Email
Sending EmailSending Email
Sending Email
 
Mobile platforms
Mobile platformsMobile platforms
Mobile platforms
 
Virtualization in cloud computing
Virtualization in cloud computingVirtualization in cloud computing
Virtualization in cloud computing
 
Cloud computing notes
Cloud computing notesCloud computing notes
Cloud computing notes
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
Java(Polymorphism)
Java(Polymorphism)Java(Polymorphism)
Java(Polymorphism)
 
Ooad 2marks
Ooad 2marksOoad 2marks
Ooad 2marks
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Java awt (abstract window toolkit)
Java awt (abstract window toolkit)
 
Anatomy of android application
Anatomy of android applicationAnatomy of android application
Anatomy of android application
 
Android - Graphics Animation in Android
Android - Graphics Animation in AndroidAndroid - Graphics Animation in Android
Android - Graphics Animation in Android
 
Servlet life cycle
Servlet life cycleServlet life cycle
Servlet life cycle
 
Ipv6 the next generation protocol
Ipv6 the next generation protocolIpv6 the next generation protocol
Ipv6 the next generation protocol
 
Vb6 vs vb.net....(visual basic) presentation
Vb6 vs vb.net....(visual basic) presentationVb6 vs vb.net....(visual basic) presentation
Vb6 vs vb.net....(visual basic) presentation
 
Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big Picture
 
Address Resolution Protocol
Address Resolution ProtocolAddress Resolution Protocol
Address Resolution Protocol
 

Similar to Develop a native application that uses GPS location.pptx

MAD Unit 6.pptx
MAD Unit 6.pptxMAD Unit 6.pptx
MAD Unit 6.pptx
34ShreyaChauhan
 
How to use geolocation in react native apps
How to use geolocation in react native appsHow to use geolocation in react native apps
How to use geolocation in react native apps
InnovationM
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
IJERD Editor
 
Windows phone 7 series
Windows phone 7 seriesWindows phone 7 series
Windows phone 7 seriesopenbala
 
Mobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdfMobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdf
AbdullahMunir32
 
MBLTDev: Phillip Connaughton, RunKepper
MBLTDev: Phillip Connaughton, RunKepper MBLTDev: Phillip Connaughton, RunKepper
MBLTDev: Phillip Connaughton, RunKepper
e-Legion
 
Core Location in iOS
Core Location in iOSCore Location in iOS
Core Location in iOS
Juan C Catalan
 
Battery Efficient Location Services
Battery Efficient Location ServicesBattery Efficient Location Services
Battery Efficient Location Services
Arun Nagarajan
 
Boldly Go Where No Man Has Gone Before. Explore Geo on iPhone & Android
Boldly Go Where No Man Has Gone Before. Explore Geo on iPhone & AndroidBoldly Go Where No Man Has Gone Before. Explore Geo on iPhone & Android
Boldly Go Where No Man Has Gone Before. Explore Geo on iPhone & Android
Bess Ho
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors API
eleksdev
 
Location based services
Location based servicesLocation based services
Location based services
BRILLMINDZ TECHNOLOGIES
 
Smart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating SystemSmart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating System
IOSR Journals
 
097 smart devices-con_las_aplicaciones_de_gestión
097 smart devices-con_las_aplicaciones_de_gestión097 smart devices-con_las_aplicaciones_de_gestión
097 smart devices-con_las_aplicaciones_de_gestiónGeneXus
 
Corso WebApp iOS - Lezione 07: iOS WebApp Anatomy
Corso WebApp iOS - Lezione 07: iOS WebApp AnatomyCorso WebApp iOS - Lezione 07: iOS WebApp Anatomy
Corso WebApp iOS - Lezione 07: iOS WebApp Anatomy
Andrea Picchi
 
Developing Windows Phone Apps with Maps and Location Services
Developing Windows Phone Apps with Maps and Location ServicesDeveloping Windows Phone Apps with Maps and Location Services
Developing Windows Phone Apps with Maps and Location Services
Nick Landry
 
Pandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 AgentPandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 Agent
Pandora FMS
 
Android App Development 04 : Location API
Android App Development 04 : Location APIAndroid App Development 04 : Location API
Android App Development 04 : Location APIAnuchit Chalothorn
 
Android location based services
Android location based servicesAndroid location based services
Android location based services
aswath babu
 
iOS Core location
iOS Core locationiOS Core location
iOS Core locationRicha Jain
 

Similar to Develop a native application that uses GPS location.pptx (20)

MAD Unit 6.pptx
MAD Unit 6.pptxMAD Unit 6.pptx
MAD Unit 6.pptx
 
How to use geolocation in react native apps
How to use geolocation in react native appsHow to use geolocation in react native apps
How to use geolocation in react native apps
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
Windows phone 7 series
Windows phone 7 seriesWindows phone 7 series
Windows phone 7 series
 
Mobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdfMobile Application Development-Lecture 15 & 16.pdf
Mobile Application Development-Lecture 15 & 16.pdf
 
MBLTDev: Phillip Connaughton, RunKepper
MBLTDev: Phillip Connaughton, RunKepper MBLTDev: Phillip Connaughton, RunKepper
MBLTDev: Phillip Connaughton, RunKepper
 
Core Location in iOS
Core Location in iOSCore Location in iOS
Core Location in iOS
 
Battery Efficient Location Services
Battery Efficient Location ServicesBattery Efficient Location Services
Battery Efficient Location Services
 
Boldly Go Where No Man Has Gone Before. Explore Geo on iPhone & Android
Boldly Go Where No Man Has Gone Before. Explore Geo on iPhone & AndroidBoldly Go Where No Man Has Gone Before. Explore Geo on iPhone & Android
Boldly Go Where No Man Has Gone Before. Explore Geo on iPhone & Android
 
report
reportreport
report
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors API
 
Location based services
Location based servicesLocation based services
Location based services
 
Smart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating SystemSmart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating System
 
097 smart devices-con_las_aplicaciones_de_gestión
097 smart devices-con_las_aplicaciones_de_gestión097 smart devices-con_las_aplicaciones_de_gestión
097 smart devices-con_las_aplicaciones_de_gestión
 
Corso WebApp iOS - Lezione 07: iOS WebApp Anatomy
Corso WebApp iOS - Lezione 07: iOS WebApp AnatomyCorso WebApp iOS - Lezione 07: iOS WebApp Anatomy
Corso WebApp iOS - Lezione 07: iOS WebApp Anatomy
 
Developing Windows Phone Apps with Maps and Location Services
Developing Windows Phone Apps with Maps and Location ServicesDeveloping Windows Phone Apps with Maps and Location Services
Developing Windows Phone Apps with Maps and Location Services
 
Pandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 AgentPandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 Agent
 
Android App Development 04 : Location API
Android App Development 04 : Location APIAndroid App Development 04 : Location API
Android App Development 04 : Location API
 
Android location based services
Android location based servicesAndroid location based services
Android location based services
 
iOS Core location
iOS Core locationiOS Core location
iOS Core location
 

More from vishal choudhary

SE-Lecture1.ppt
SE-Lecture1.pptSE-Lecture1.ppt
SE-Lecture1.ppt
vishal choudhary
 
SE-Testing.ppt
SE-Testing.pptSE-Testing.ppt
SE-Testing.ppt
vishal choudhary
 
SE-CyclomaticComplexityand Testing.ppt
SE-CyclomaticComplexityand Testing.pptSE-CyclomaticComplexityand Testing.ppt
SE-CyclomaticComplexityand Testing.ppt
vishal choudhary
 
SE-Lecture-7.pptx
SE-Lecture-7.pptxSE-Lecture-7.pptx
SE-Lecture-7.pptx
vishal choudhary
 
Se-Lecture-6.ppt
Se-Lecture-6.pptSe-Lecture-6.ppt
Se-Lecture-6.ppt
vishal choudhary
 
SE-Lecture-5.pptx
SE-Lecture-5.pptxSE-Lecture-5.pptx
SE-Lecture-5.pptx
vishal choudhary
 
SE-Lecture-8.pptx
SE-Lecture-8.pptxSE-Lecture-8.pptx
SE-Lecture-8.pptx
vishal choudhary
 
SE-coupling and cohesion.ppt
SE-coupling and cohesion.pptSE-coupling and cohesion.ppt
SE-coupling and cohesion.ppt
vishal choudhary
 
SE-Lecture-2.pptx
SE-Lecture-2.pptxSE-Lecture-2.pptx
SE-Lecture-2.pptx
vishal choudhary
 
SE-software design.ppt
SE-software design.pptSE-software design.ppt
SE-software design.ppt
vishal choudhary
 
SE1.ppt
SE1.pptSE1.ppt
SE-Lecture-4.pptx
SE-Lecture-4.pptxSE-Lecture-4.pptx
SE-Lecture-4.pptx
vishal choudhary
 
SE-Lecture=3.pptx
SE-Lecture=3.pptxSE-Lecture=3.pptx
SE-Lecture=3.pptx
vishal choudhary
 
Multimedia-Lecture-Animation.pptx
Multimedia-Lecture-Animation.pptxMultimedia-Lecture-Animation.pptx
Multimedia-Lecture-Animation.pptx
vishal choudhary
 
MultimediaLecture5.pptx
MultimediaLecture5.pptxMultimediaLecture5.pptx
MultimediaLecture5.pptx
vishal choudhary
 
Multimedia-Lecture-7.pptx
Multimedia-Lecture-7.pptxMultimedia-Lecture-7.pptx
Multimedia-Lecture-7.pptx
vishal choudhary
 
MultiMedia-Lecture-4.pptx
MultiMedia-Lecture-4.pptxMultiMedia-Lecture-4.pptx
MultiMedia-Lecture-4.pptx
vishal choudhary
 
Multimedia-Lecture-6.pptx
Multimedia-Lecture-6.pptxMultimedia-Lecture-6.pptx
Multimedia-Lecture-6.pptx
vishal choudhary
 
Multimedia-Lecture-3.pptx
Multimedia-Lecture-3.pptxMultimedia-Lecture-3.pptx
Multimedia-Lecture-3.pptx
vishal choudhary
 

More from vishal choudhary (20)

SE-Lecture1.ppt
SE-Lecture1.pptSE-Lecture1.ppt
SE-Lecture1.ppt
 
SE-Testing.ppt
SE-Testing.pptSE-Testing.ppt
SE-Testing.ppt
 
SE-CyclomaticComplexityand Testing.ppt
SE-CyclomaticComplexityand Testing.pptSE-CyclomaticComplexityand Testing.ppt
SE-CyclomaticComplexityand Testing.ppt
 
SE-Lecture-7.pptx
SE-Lecture-7.pptxSE-Lecture-7.pptx
SE-Lecture-7.pptx
 
Se-Lecture-6.ppt
Se-Lecture-6.pptSe-Lecture-6.ppt
Se-Lecture-6.ppt
 
SE-Lecture-5.pptx
SE-Lecture-5.pptxSE-Lecture-5.pptx
SE-Lecture-5.pptx
 
XML.pptx
XML.pptxXML.pptx
XML.pptx
 
SE-Lecture-8.pptx
SE-Lecture-8.pptxSE-Lecture-8.pptx
SE-Lecture-8.pptx
 
SE-coupling and cohesion.ppt
SE-coupling and cohesion.pptSE-coupling and cohesion.ppt
SE-coupling and cohesion.ppt
 
SE-Lecture-2.pptx
SE-Lecture-2.pptxSE-Lecture-2.pptx
SE-Lecture-2.pptx
 
SE-software design.ppt
SE-software design.pptSE-software design.ppt
SE-software design.ppt
 
SE1.ppt
SE1.pptSE1.ppt
SE1.ppt
 
SE-Lecture-4.pptx
SE-Lecture-4.pptxSE-Lecture-4.pptx
SE-Lecture-4.pptx
 
SE-Lecture=3.pptx
SE-Lecture=3.pptxSE-Lecture=3.pptx
SE-Lecture=3.pptx
 
Multimedia-Lecture-Animation.pptx
Multimedia-Lecture-Animation.pptxMultimedia-Lecture-Animation.pptx
Multimedia-Lecture-Animation.pptx
 
MultimediaLecture5.pptx
MultimediaLecture5.pptxMultimediaLecture5.pptx
MultimediaLecture5.pptx
 
Multimedia-Lecture-7.pptx
Multimedia-Lecture-7.pptxMultimedia-Lecture-7.pptx
Multimedia-Lecture-7.pptx
 
MultiMedia-Lecture-4.pptx
MultiMedia-Lecture-4.pptxMultiMedia-Lecture-4.pptx
MultiMedia-Lecture-4.pptx
 
Multimedia-Lecture-6.pptx
Multimedia-Lecture-6.pptxMultimedia-Lecture-6.pptx
Multimedia-Lecture-6.pptx
 
Multimedia-Lecture-3.pptx
Multimedia-Lecture-3.pptxMultimedia-Lecture-3.pptx
Multimedia-Lecture-3.pptx
 

Recently uploaded

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Ashish Kohli
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 

Recently uploaded (20)

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 

Develop a native application that uses GPS location.pptx

  • 1. Expe-7 Develop a native application that uses GPS location information
  • 2. Android location APIs make it easy for you to build location- aware applications, without needing to focus on the details of the underlying location technology. The Location Object The Location object represents a geographic location which can consist of a latitude, longitude, time stamp, and other information such as bearing, altitude and velocity. There are following important methods which you can use with Location object to get location specific information −
  • 3. Sr.No. Method & Description 1 float distanceTo(Location dest) Returns the approximate distance in meters between this location and the given location. 2 float getAccuracy() Get the estimated accuracy of this location, in meters. 3 double getAltitude() Get the altitude if available, in meters above sea level. 4 float getBearing() Get the bearing, in degrees. 5 double getLatitude() Get the latitude, in degrees. 6 double getLongitude() Get the longitude, in degrees. 7 float getSpeed() Get the speed if it is available, in meters/second over ground. 8 boolean hasAccuracy() True if this location has an accuracy. 9 boolean hasAltitude() True if this location has an altitude. 10 boolean hasBearing() True if this location has a bearing. 11 boolean hasSpeed() True if this location has a speed. 12 void reset() Clears the contents of the location. 13 void setAccuracy(float accuracy) Set the estimated accuracy of this location, meters. 14 void setAltitude(double altitude) Set the altitude, in meters above sea level. 15 void setBearing(float bearing) Set the bearing, in degrees. 16 void setLatitude(double latitude) Set the latitude, in degrees. 17 void setLongitude(double longitude) Set the longitude, in degrees.
  • 4. Get the Current Location  To get the current location, create a location client which is LocationClient object, connect it to Location Services using connect() method, and then call its getLastLocation() method. This method returns the most recent location in the form of Location object that contains latitude and longitude coordinates and other information as explained above. To have location based functionality in your activity, you will have to implement two interfaces −  GooglePlayServicesClient.ConnectionCallbacks  GooglePlayServicesClient.OnConnectionFailedListen er  These interfaces provide following important callback methods, which you need to implement in your activity
  • 5. Sr. No. Callback Methods & Description 1 abstract void onConnected(Bundle connectionHint) This callback method is called when location service is connected to the location client successfully. You will use connect() method to connect to the location client. 2 abstract void onDisconnected() This callback method is called when the client is disconnected. You will use disconnect() method to disconnect from the location client. 3 abstract void onConnectionFailed(ConnectionResult result) This callback method is called when there was an error connecting the client to the service.
  • 6. Location Quality of Service Sr.N o. Method & Description 1 setExpirationDuration(long millis) Set the duration of this request, in milliseconds. 2 setExpirationTime(long millis) Set the request expiration time, in millisecond since boot. 3 setFastestInterval(long millis) Explicitly set the fastest interval for location updates, in milliseconds. 4 setInterval(long millis) Set the desired interval for active location updates, in milliseconds. 5 setNumUpdates(int numUpdates) Set the number of location updates. 6 setPriority(int priority) Set the priority of the request.
  • 7. Create Android Application Step Description 1 You will use Android studio IDE to create an Android application 2 add src/GPSTracker.java file and add required code. 3 Modify src/MainActivity.java file and add required code as shown below to take care of getting current location and its equivalent address. 4 Modify layout XML file res/layout/activity_main.xml to add all GUI components which include three buttons and two text views to show location/address. 5 Modify res/values/strings.xml to define required constant values 6 Modify AndroidManifest.xml as shown below 7 Run the application to launch Android emulator and verify the result of the changes done in the application.