SlideShare a Scribd company logo
1 of 55
CSI-615 Mobile and Application Development
Displaying Google Maps
• It is possible to display maps in Android applications.
• Android provides a built-in library called Google Maps Android API
that allows you to integrate Google Maps in your Android app.
• This API provides a set of tools for displaying maps, adding markers
and overlays, and interacting with the map.
Displaying Google Maps cont…
• To use the Google Maps Android API, you need to first obtain an API
key from the Google Cloud Console.
• Once you have your API key, you can add the Google Maps Android API
to your app by adding the following dependency to your app's
build.gradle file:
• Implementation 'com.google.android.gms:play-services-maps:17.0.0'
Displaying Google Maps cont…
the following permissions to your app's
• You also need to add
AndroidManifest.xml file:
• <uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"/>
• <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
Displaying Google Maps cont…
• To display the map in your app, you can add a MapView to your app's
layout file and initialize it in your app's activity or fragment.
• For example:
Displaying Google Maps cont…
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
Displaying Google Maps cont…
• In your activity or fragment, you can then initialize the MapView and
add a GoogleMap object to it:
Displaying Google Maps cont…
• // Initialize the MapView
• MapView mapView = findViewById(R.id.map);
• mapView.onCreate(savedInstanceState);
• // Get the GoogleMap object
• mapView.getMapAsync(new OnMapReadyCallback() {
• @Override
• public void onMapReady(GoogleMap googleMap) {
• // Do something with the GoogleMap object
• }
• });
Android web Services
Web Services
• Web services are a collection of open-source protocols and standards
(SOAP, UDDI, REST, XML-RPC, etc.) that are useful for the exchange of
data between systems or applications.
• Web services are built on top of open standards such as TCP/IP, HTTP,
Java, HTML, and XML.
Web Services cont…
Web Services cont…
• A web service is basically required to provide interoperability, i.e.
connecting various applications.
• It allows different apps to communicate with each other and share
the data and services among themselves.
• Web services provide a standard for all the types of client applications
to invoke functions on every type of app server.
Web Services cont… Android Web
Services Components
• The web server architecture generally contains the following three
roles-
• Publisher: The publisher can be understood as a Service provider.
• The publisher is responsible for creating the web service and making
it available for the Clients.
Web Services cont… Android Web
Services Components
• Subscriber: The Subscriber is nothing but, the service requester.
• The Service requester is the one that needs to contact the web
service.
• The client application will contact through a client application.
• This Client application can be based on .Net or any language based
language.
Web Services cont… Android Web
Services Components
• Broker: The broker here is the application that provides access to the
UDDI.
• The UDDI stands for Universal Description Discovery and Integration.
• It enables the client application to locate the web service exactly.
Web Services cont… Android Web
Services Working
• The working mechanism of web services is given below:
• Publish: Publishers Publishing the web services means informing the
broker about its existence.
• It is done using the Broker’s interface to make is easily accessible to
the subscribers
Web Services cont… Android Web
Services Working
• Subscribe: The Subscriber will consult the broker to
published web service easily .
locate the
• Bind: Once the information regarding the web services is gained from
the broker, the subscriber can bind the web service.
Web Services cont…
Open-source protocols and standards
• The different open-source protocols and standards that are useful for the
exchange of data between systems or applications are discussed here:
• XML-RPC (Remote Procedure Call) is the most basic XML protocol to
exchange data between a wide variety of devices on a network.
• It uses HTTP to quickly and easily transfer data and communication other
information from client to server.
Web Services cont…
Open-source protocols and standards
• UDDI (Universal Description, Discovery, and Integration) is an XML-
based standard for detailing, publishing, and discovering web
services.
• It’s basically an internet registry for businesses around the world.
• The goal is to streamline digital transactions and e-commerce among
company systems.
Web Services cont…
Open-source protocols and standards
• SOAP (Simple Object Access Protocol), is an XML-based Web service
protocol to exchange data and documents over HTTP or SMTP (Simple
Mail Transfer Protocol).
• It allows independent processes operating on disparate systems to
communicate using XML.
Web Services cont…
Open-source protocols and standards
• REST (Representational state transfer), provides communication and
connectivity between devices and the internet for API-based tasks.
• Most RESTful services use HTTP as the supporting protocol.
Web Services cont… Characteristics of
Web Services
• Here are the following characteristics of Web Services:
• Interoperability:
• Web services allow various applications to talk to each other and share data and
services among themselves.
• For example, a VB or .NET application can talk to Java web services and vice versa.
• Web services are used to make the application platform and technology
independent.
Web Services cont… Characteristics of
Web Services
• XML-Based:
• Web services use XML at data representationand data transportation
layers.
• Using XML eliminates any networking, operating system, or platform
binding.
• Web services based applications are highly interoperable at their core
level.
Web Services cont… Characteristics of
Web Services
• Supports Document Exchange:
• One of the key advantages of XML is its generic way of representing
not only data, but also complex documents.
• These documents can be as simple as representing a current address,
or they can be as complex as representing a book or Request for
Quotation (RFQ).
Web Services cont… Characteristics of
Web Services
• Ability to be Synchronous or Asynchronous:
• In synchronous invocations, the client blocks and waits for the service to
complete its operation.
• Asynchronous operations allow a client to invoke a service and then execute
other functions.
• Asynchronous clients retrieve their result at a later point in time, while
synchronous clients receive their result when the service has completed.
Web Services cont… Characteristics of
Web Services
• Supports Remote Procedure Calls (RPCs):
• Web services allow clients to invoke procedures, functions, and methods
on remote objects using an XML-based protocol. Remote procedures
expose input and output parameters that a web service must support.
• Component development through Enterprise Java Beans (EJBs) and .NET
Components has increasingly become a part of architectures and
enterprise deployments over the past couple of years.
Web Services cont… Characteristics of
Web Services
• Standardized Protocol:
• Web services use standardized industry standard protocol for the
communication.
• All the four layers (Service Transport, XML Messaging, Service
Description, and Service Discovery layers) use well-defined protocols
in the web services protocol stack.
Web Services cont… Characteristics of
Web Services
• Low Cost Communication:
• Web services use SOAP over HTTP protocol, so you can use your
existing low-cost internet for implementing web services.
• Besides SOAP over HTTP, web services can also be implemented on
other reliable transport mechanisms like FTP.
Threading in Android
Threading
• Thread is a lightweight sub-process that provides us a way to do
background operations without interrupting the User Interface (UI).
• When an app is launched, it creates a single thread in which all app
components will run by default.
• The thread which is created by the runtime system is known as the
main thread.
Threading cont…
• The main thread’s primary role is to handle the UI in terms of event
handling and interaction with views in the UI.
• If there is a task that is time-consuming and that task is run on the
main thread, then it will stop other tasks until it gets completed, which
in turn may result in displaying a warning “Application is unresponsive”
to the user by the operating system.
Threading cont…
• So we need different threads for such tasks.
• As you can see the following image, showing threads
different tasks over main thread and background thread also:
handling
Threading cont…
Threading cont…
• In android, all threading components belong to one of two basic
categories.
• 1- Threads that are attached to an activity/fragment: This category
of threads are bound to the lifecycle of the activity/fragment and
these are terminated as soon as the activity/fragment is destroyed.
• Thread components: AsyncTask, Loaders.
Threading cont…
• 2- Threads that aren’t attached to any activity/fragment: These
types of threads can continue to run beyond the lifetime of the
activity or fragment from which they were spawned.
• Threading Components: Service.
Threading cont…
Attached to an activity/fragment: ASYNCTASK
• AsyncTask is the most elementary Android component for threading.
• It’s super easy and simple to use it’s also good for some basic
scenarios:
Threading
cont…
Attached to
an activity/
fragment:
ASYNCTASK
Threading cont…
Attached to an activity/fragment: ASYNCTASK
• AsyncTask, however, falls short if you would like your deferred task to
run beyond the lifetime of the activity/fragment.
• The fact that even the slightest of screen rotation can cause the
activity to be destroyed is simply awful!
• So We Come to Loaders:
Threading cont…
Attached to an activity/fragment: LOADERS
• Loaders are the answer to the awful nightmare mentioned above.
• Loaders are great at performing in that context and they
automatically stop when the activity is destroyed, even more, the
sweet fact is that they also restart themselves after the activity is
recreated.
Threading cont…
Attached to an activity/fragment: LOADERS
Threading cont…
Not attached to an activity/fragment: SERVICE
• Service could be thought of as a component that’s useful for
performing long (or potentially long) operations with no UI.
• Service’s don’t have any UI.
• Service runs within the main thread of its hosting process; the service
doesn’t create its own thread and doesn’t run during a separate
process unless you specify otherwise.
Threading cont…
Not attached to an activity/fragment: SERVICE
Threading cont…
Not attached to an activity/fragment: SERVICE
• Service could be thought of as a component that’s useful for
performing long (or potentially long) operations with no UI.
• Service’s don’t have any UI.
• Service runs within the main thread of its hosting process; the service
doesn’t create its own thread and doesn’t run during a separate
process unless you specify otherwise.
Threading cont…
Not attached to an activity/fragment: SERVICE
• Service could be thought of as a component that’s useful for
performing long (or potentially long) operations with no UI.
• Service’s don’t have any UI.
• Service runs within the main thread of its hosting process; the service
doesn’t create its own thread and doesn’t run during a separate
process unless you specify otherwise.
Threading cont…
• There are five types of thread used in Android mobile development:
1. Main Thread
2. UI Thread
3. Worker Thread
4. Any Thread
5. Binder Thread
Threading cont… Main Thread
• When we launch our app on Android, it creates the first thread of
execution called the “Main Thread”.
• The communication between the components from the Android UI
toolkit and the dispatching of events to their appropriate UI widgets is
handled by the main thread.
Threading cont… Main Thread
• We should avoid network operations, database calls, and the loading of
certain components in the main thread.
• Because the main thread is called synchronously when executed, that
means the user interface will remain completely unresponsive until the
performance completes.
Threading cont… Main Thread
Threading cont… UI Thread
• Every app in Android has its own thread which is responsible for
running the UI objects, like view objects.
• Such a thread is known as the UI thread.
• The UI thread is the main thread of execution for our app as this is
where most of the app code is run.
Threading cont… UI Thread
• The UI thread is where all of our app components (like activities,
services, content providers, and broadcast receivers) are created.
• This thread allows our tasks to perform their background work and
then move the results to UI elements such as bitmaps.
• All objects running on our UI thread will be able to access other
objects which are also running on the same UI thread.
Threading cont… UI Thread
• The tasks that we run on a thread from a thread pool do not run on
our UI thread, so they will not have access to UI objects.
• The data moves from a background thread to the UI thread, using a
handler that runs on the UI thread.
Threading cont…
The Worker Thread
• The worker thread is a background thread.
• The worker threads are created separately, other than threads like the
UI thread.
• As we know from the rules, we cannot block a UI thread so this is
where the worker thread comes into play since we can use them to
run the child processes and tasks.
Threading cont… Any Thread
• In Any thread, the annotated method can be called from any thread.
• If the annotated element is a class, then all methods in the class can
be called from Any Thread.
Threading cont… Any Thread
Threading cont… Binder Thread
• Binder thread represents a separate thread of service.
• The binder is a mechanism that provides inter-process communication.
• The binder thread is used in service binding with interprocess
communication.
• This concept is mainly related to service calls with interfaces defined by
Android Interface Definition Language (AIDL).

More Related Content

Similar to Displaying google maps in mobileapplication.pptx

Chap 5 software as a service (saass)
Chap 5 software as a service (saass)Chap 5 software as a service (saass)
Chap 5 software as a service (saass)Raj Sarode
 
Andriod Lecture 8 A.pptx
Andriod Lecture 8 A.pptxAndriod Lecture 8 A.pptx
Andriod Lecture 8 A.pptxfaiz324545
 
Development of Web Services for Android Applications
Development of Web Services for Android ApplicationsDevelopment of Web Services for Android Applications
Development of Web Services for Android ApplicationsMd Ashraful Haque
 
Applying xml
Applying xmlApplying xml
Applying xmlKumar
 
SOA Fundamentals
SOA  FundamentalsSOA  Fundamentals
SOA Fundamentalsabhi1112
 
What is the difference between an api and web services
What is the difference between an api and web servicesWhat is the difference between an api and web services
What is the difference between an api and web servicesAparna Sharma
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service IntroductionMadhukar Kumar
 
Android Development Tutorial
Android Development TutorialAndroid Development Tutorial
Android Development TutorialGermán Bringas
 
Unit-5_2 PPT on Distributed Web based System.pdf
Unit-5_2 PPT on Distributed Web based System.pdfUnit-5_2 PPT on Distributed Web based System.pdf
Unit-5_2 PPT on Distributed Web based System.pdframeshwarchintamani
 
Primavera unifier integration_wp
Primavera unifier integration_wpPrimavera unifier integration_wp
Primavera unifier integration_wpCampin Chou
 
ppt-3-iotlogicdesign-210125034351.pptx
ppt-3-iotlogicdesign-210125034351.pptxppt-3-iotlogicdesign-210125034351.pptx
ppt-3-iotlogicdesign-210125034351.pptxjohnpragasam1
 
WEB-DBMS A quick reference
WEB-DBMS A quick referenceWEB-DBMS A quick reference
WEB-DBMS A quick referenceMarc Dy
 
Integrated Services for Web Applications
Integrated Services for Web ApplicationsIntegrated Services for Web Applications
Integrated Services for Web ApplicationsSaltmarch Media
 
Peoplesoft PIA architecture
Peoplesoft PIA architecturePeoplesoft PIA architecture
Peoplesoft PIA architectureAmit rai Raaz
 

Similar to Displaying google maps in mobileapplication.pptx (20)

Chap 5 software as a service (saass)
Chap 5 software as a service (saass)Chap 5 software as a service (saass)
Chap 5 software as a service (saass)
 
Andriod Lecture 8 A.pptx
Andriod Lecture 8 A.pptxAndriod Lecture 8 A.pptx
Andriod Lecture 8 A.pptx
 
Development of Web Services for Android Applications
Development of Web Services for Android ApplicationsDevelopment of Web Services for Android Applications
Development of Web Services for Android Applications
 
Applying xml
Applying xmlApplying xml
Applying xml
 
Wt unit 6 ppts web services
Wt unit 6 ppts web servicesWt unit 6 ppts web services
Wt unit 6 ppts web services
 
Demistifying serverless on aws
Demistifying serverless on awsDemistifying serverless on aws
Demistifying serverless on aws
 
SOA Fundamentals
SOA  FundamentalsSOA  Fundamentals
SOA Fundamentals
 
What is the difference between an api and web services
What is the difference between an api and web servicesWhat is the difference between an api and web services
What is the difference between an api and web services
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service Introduction
 
Java web services
Java web servicesJava web services
Java web services
 
Cc unit 2 updated
Cc unit 2 updatedCc unit 2 updated
Cc unit 2 updated
 
Android Development Tutorial
Android Development TutorialAndroid Development Tutorial
Android Development Tutorial
 
Unit-5_2 PPT on Distributed Web based System.pdf
Unit-5_2 PPT on Distributed Web based System.pdfUnit-5_2 PPT on Distributed Web based System.pdf
Unit-5_2 PPT on Distributed Web based System.pdf
 
Primavera unifier integration_wp
Primavera unifier integration_wpPrimavera unifier integration_wp
Primavera unifier integration_wp
 
Microservices
MicroservicesMicroservices
Microservices
 
ppt-3-iotlogicdesign-210125034351.pptx
ppt-3-iotlogicdesign-210125034351.pptxppt-3-iotlogicdesign-210125034351.pptx
ppt-3-iotlogicdesign-210125034351.pptx
 
WEB-DBMS A quick reference
WEB-DBMS A quick referenceWEB-DBMS A quick reference
WEB-DBMS A quick reference
 
Integrated Services for Web Applications
Integrated Services for Web ApplicationsIntegrated Services for Web Applications
Integrated Services for Web Applications
 
Peoplesoft PIA architecture
Peoplesoft PIA architecturePeoplesoft PIA architecture
Peoplesoft PIA architecture
 
Web services
Web servicesWeb services
Web services
 

More from sanaiftikhar23

Object Oriented Programming Language is an oop
Object Oriented Programming Language is an oopObject Oriented Programming Language is an oop
Object Oriented Programming Language is an oopsanaiftikhar23
 
MobApp 07 componentof screen layout.pptx
MobApp 07 componentof screen layout.pptxMobApp 07 componentof screen layout.pptx
MobApp 07 componentof screen layout.pptxsanaiftikhar23
 
MobApp development 01 application platform.pptx
MobApp development 01 application platform.pptxMobApp development 01 application platform.pptx
MobApp development 01 application platform.pptxsanaiftikhar23
 
Visual programming is a type of programming
Visual programming is a type of programmingVisual programming is a type of programming
Visual programming is a type of programmingsanaiftikhar23
 
L21-Introduction-to-IO.ppt
L21-Introduction-to-IO.pptL21-Introduction-to-IO.ppt
L21-Introduction-to-IO.pptsanaiftikhar23
 
fundamentals-of-algorithm-2nd-lec-170418023540.pdf
fundamentals-of-algorithm-2nd-lec-170418023540.pdffundamentals-of-algorithm-2nd-lec-170418023540.pdf
fundamentals-of-algorithm-2nd-lec-170418023540.pdfsanaiftikhar23
 

More from sanaiftikhar23 (7)

Object Oriented Programming Language is an oop
Object Oriented Programming Language is an oopObject Oriented Programming Language is an oop
Object Oriented Programming Language is an oop
 
MobApp 07 componentof screen layout.pptx
MobApp 07 componentof screen layout.pptxMobApp 07 componentof screen layout.pptx
MobApp 07 componentof screen layout.pptx
 
MobApp development 01 application platform.pptx
MobApp development 01 application platform.pptxMobApp development 01 application platform.pptx
MobApp development 01 application platform.pptx
 
Visual programming is a type of programming
Visual programming is a type of programmingVisual programming is a type of programming
Visual programming is a type of programming
 
L21-Introduction-to-IO.ppt
L21-Introduction-to-IO.pptL21-Introduction-to-IO.ppt
L21-Introduction-to-IO.ppt
 
fundamentals-of-algorithm-2nd-lec-170418023540.pdf
fundamentals-of-algorithm-2nd-lec-170418023540.pdffundamentals-of-algorithm-2nd-lec-170418023540.pdf
fundamentals-of-algorithm-2nd-lec-170418023540.pdf
 
templates.pptx
templates.pptxtemplates.pptx
templates.pptx
 

Recently uploaded

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

Displaying google maps in mobileapplication.pptx

  • 1. CSI-615 Mobile and Application Development
  • 2. Displaying Google Maps • It is possible to display maps in Android applications. • Android provides a built-in library called Google Maps Android API that allows you to integrate Google Maps in your Android app. • This API provides a set of tools for displaying maps, adding markers and overlays, and interacting with the map.
  • 3. Displaying Google Maps cont… • To use the Google Maps Android API, you need to first obtain an API key from the Google Cloud Console. • Once you have your API key, you can add the Google Maps Android API to your app by adding the following dependency to your app's build.gradle file: • Implementation 'com.google.android.gms:play-services-maps:17.0.0'
  • 4. Displaying Google Maps cont… the following permissions to your app's • You also need to add AndroidManifest.xml file: • <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> • <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  • 5. Displaying Google Maps cont… • To display the map in your app, you can add a MapView to your app's layout file and initialize it in your app's activity or fragment. • For example:
  • 6. Displaying Google Maps cont… <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MapsActivity" />
  • 7. Displaying Google Maps cont… • In your activity or fragment, you can then initialize the MapView and add a GoogleMap object to it:
  • 8. Displaying Google Maps cont… • // Initialize the MapView • MapView mapView = findViewById(R.id.map); • mapView.onCreate(savedInstanceState); • // Get the GoogleMap object • mapView.getMapAsync(new OnMapReadyCallback() { • @Override • public void onMapReady(GoogleMap googleMap) { • // Do something with the GoogleMap object • } • });
  • 10. Web Services • Web services are a collection of open-source protocols and standards (SOAP, UDDI, REST, XML-RPC, etc.) that are useful for the exchange of data between systems or applications. • Web services are built on top of open standards such as TCP/IP, HTTP, Java, HTML, and XML.
  • 12. Web Services cont… • A web service is basically required to provide interoperability, i.e. connecting various applications. • It allows different apps to communicate with each other and share the data and services among themselves. • Web services provide a standard for all the types of client applications to invoke functions on every type of app server.
  • 13. Web Services cont… Android Web Services Components • The web server architecture generally contains the following three roles- • Publisher: The publisher can be understood as a Service provider. • The publisher is responsible for creating the web service and making it available for the Clients.
  • 14. Web Services cont… Android Web Services Components • Subscriber: The Subscriber is nothing but, the service requester. • The Service requester is the one that needs to contact the web service. • The client application will contact through a client application. • This Client application can be based on .Net or any language based language.
  • 15. Web Services cont… Android Web Services Components • Broker: The broker here is the application that provides access to the UDDI. • The UDDI stands for Universal Description Discovery and Integration. • It enables the client application to locate the web service exactly.
  • 16. Web Services cont… Android Web Services Working • The working mechanism of web services is given below: • Publish: Publishers Publishing the web services means informing the broker about its existence. • It is done using the Broker’s interface to make is easily accessible to the subscribers
  • 17. Web Services cont… Android Web Services Working • Subscribe: The Subscriber will consult the broker to published web service easily . locate the • Bind: Once the information regarding the web services is gained from the broker, the subscriber can bind the web service.
  • 18. Web Services cont… Open-source protocols and standards • The different open-source protocols and standards that are useful for the exchange of data between systems or applications are discussed here: • XML-RPC (Remote Procedure Call) is the most basic XML protocol to exchange data between a wide variety of devices on a network. • It uses HTTP to quickly and easily transfer data and communication other information from client to server.
  • 19. Web Services cont… Open-source protocols and standards • UDDI (Universal Description, Discovery, and Integration) is an XML- based standard for detailing, publishing, and discovering web services. • It’s basically an internet registry for businesses around the world. • The goal is to streamline digital transactions and e-commerce among company systems.
  • 20. Web Services cont… Open-source protocols and standards • SOAP (Simple Object Access Protocol), is an XML-based Web service protocol to exchange data and documents over HTTP or SMTP (Simple Mail Transfer Protocol). • It allows independent processes operating on disparate systems to communicate using XML.
  • 21. Web Services cont… Open-source protocols and standards • REST (Representational state transfer), provides communication and connectivity between devices and the internet for API-based tasks. • Most RESTful services use HTTP as the supporting protocol.
  • 22. Web Services cont… Characteristics of Web Services • Here are the following characteristics of Web Services: • Interoperability: • Web services allow various applications to talk to each other and share data and services among themselves. • For example, a VB or .NET application can talk to Java web services and vice versa. • Web services are used to make the application platform and technology independent.
  • 23. Web Services cont… Characteristics of Web Services • XML-Based: • Web services use XML at data representationand data transportation layers. • Using XML eliminates any networking, operating system, or platform binding. • Web services based applications are highly interoperable at their core level.
  • 24. Web Services cont… Characteristics of Web Services • Supports Document Exchange: • One of the key advantages of XML is its generic way of representing not only data, but also complex documents. • These documents can be as simple as representing a current address, or they can be as complex as representing a book or Request for Quotation (RFQ).
  • 25. Web Services cont… Characteristics of Web Services • Ability to be Synchronous or Asynchronous: • In synchronous invocations, the client blocks and waits for the service to complete its operation. • Asynchronous operations allow a client to invoke a service and then execute other functions. • Asynchronous clients retrieve their result at a later point in time, while synchronous clients receive their result when the service has completed.
  • 26. Web Services cont… Characteristics of Web Services • Supports Remote Procedure Calls (RPCs): • Web services allow clients to invoke procedures, functions, and methods on remote objects using an XML-based protocol. Remote procedures expose input and output parameters that a web service must support. • Component development through Enterprise Java Beans (EJBs) and .NET Components has increasingly become a part of architectures and enterprise deployments over the past couple of years.
  • 27. Web Services cont… Characteristics of Web Services • Standardized Protocol: • Web services use standardized industry standard protocol for the communication. • All the four layers (Service Transport, XML Messaging, Service Description, and Service Discovery layers) use well-defined protocols in the web services protocol stack.
  • 28. Web Services cont… Characteristics of Web Services • Low Cost Communication: • Web services use SOAP over HTTP protocol, so you can use your existing low-cost internet for implementing web services. • Besides SOAP over HTTP, web services can also be implemented on other reliable transport mechanisms like FTP.
  • 30. Threading • Thread is a lightweight sub-process that provides us a way to do background operations without interrupting the User Interface (UI). • When an app is launched, it creates a single thread in which all app components will run by default. • The thread which is created by the runtime system is known as the main thread.
  • 31. Threading cont… • The main thread’s primary role is to handle the UI in terms of event handling and interaction with views in the UI. • If there is a task that is time-consuming and that task is run on the main thread, then it will stop other tasks until it gets completed, which in turn may result in displaying a warning “Application is unresponsive” to the user by the operating system.
  • 32. Threading cont… • So we need different threads for such tasks. • As you can see the following image, showing threads different tasks over main thread and background thread also: handling
  • 34. Threading cont… • In android, all threading components belong to one of two basic categories. • 1- Threads that are attached to an activity/fragment: This category of threads are bound to the lifecycle of the activity/fragment and these are terminated as soon as the activity/fragment is destroyed. • Thread components: AsyncTask, Loaders.
  • 35. Threading cont… • 2- Threads that aren’t attached to any activity/fragment: These types of threads can continue to run beyond the lifetime of the activity or fragment from which they were spawned. • Threading Components: Service.
  • 36. Threading cont… Attached to an activity/fragment: ASYNCTASK • AsyncTask is the most elementary Android component for threading. • It’s super easy and simple to use it’s also good for some basic scenarios:
  • 38. Threading cont… Attached to an activity/fragment: ASYNCTASK • AsyncTask, however, falls short if you would like your deferred task to run beyond the lifetime of the activity/fragment. • The fact that even the slightest of screen rotation can cause the activity to be destroyed is simply awful! • So We Come to Loaders:
  • 39. Threading cont… Attached to an activity/fragment: LOADERS • Loaders are the answer to the awful nightmare mentioned above. • Loaders are great at performing in that context and they automatically stop when the activity is destroyed, even more, the sweet fact is that they also restart themselves after the activity is recreated.
  • 40. Threading cont… Attached to an activity/fragment: LOADERS
  • 41. Threading cont… Not attached to an activity/fragment: SERVICE • Service could be thought of as a component that’s useful for performing long (or potentially long) operations with no UI. • Service’s don’t have any UI. • Service runs within the main thread of its hosting process; the service doesn’t create its own thread and doesn’t run during a separate process unless you specify otherwise.
  • 42. Threading cont… Not attached to an activity/fragment: SERVICE
  • 43. Threading cont… Not attached to an activity/fragment: SERVICE • Service could be thought of as a component that’s useful for performing long (or potentially long) operations with no UI. • Service’s don’t have any UI. • Service runs within the main thread of its hosting process; the service doesn’t create its own thread and doesn’t run during a separate process unless you specify otherwise.
  • 44. Threading cont… Not attached to an activity/fragment: SERVICE • Service could be thought of as a component that’s useful for performing long (or potentially long) operations with no UI. • Service’s don’t have any UI. • Service runs within the main thread of its hosting process; the service doesn’t create its own thread and doesn’t run during a separate process unless you specify otherwise.
  • 45. Threading cont… • There are five types of thread used in Android mobile development: 1. Main Thread 2. UI Thread 3. Worker Thread 4. Any Thread 5. Binder Thread
  • 46. Threading cont… Main Thread • When we launch our app on Android, it creates the first thread of execution called the “Main Thread”. • The communication between the components from the Android UI toolkit and the dispatching of events to their appropriate UI widgets is handled by the main thread.
  • 47. Threading cont… Main Thread • We should avoid network operations, database calls, and the loading of certain components in the main thread. • Because the main thread is called synchronously when executed, that means the user interface will remain completely unresponsive until the performance completes.
  • 49. Threading cont… UI Thread • Every app in Android has its own thread which is responsible for running the UI objects, like view objects. • Such a thread is known as the UI thread. • The UI thread is the main thread of execution for our app as this is where most of the app code is run.
  • 50. Threading cont… UI Thread • The UI thread is where all of our app components (like activities, services, content providers, and broadcast receivers) are created. • This thread allows our tasks to perform their background work and then move the results to UI elements such as bitmaps. • All objects running on our UI thread will be able to access other objects which are also running on the same UI thread.
  • 51. Threading cont… UI Thread • The tasks that we run on a thread from a thread pool do not run on our UI thread, so they will not have access to UI objects. • The data moves from a background thread to the UI thread, using a handler that runs on the UI thread.
  • 52. Threading cont… The Worker Thread • The worker thread is a background thread. • The worker threads are created separately, other than threads like the UI thread. • As we know from the rules, we cannot block a UI thread so this is where the worker thread comes into play since we can use them to run the child processes and tasks.
  • 53. Threading cont… Any Thread • In Any thread, the annotated method can be called from any thread. • If the annotated element is a class, then all methods in the class can be called from Any Thread.
  • 55. Threading cont… Binder Thread • Binder thread represents a separate thread of service. • The binder is a mechanism that provides inter-process communication. • The binder thread is used in service binding with interprocess communication. • This concept is mainly related to service calls with interfaces defined by Android Interface Definition Language (AIDL).