This presentation is all about Google Location Services. What is Google Location Service, What is provides to you, How to use it in Android Programming, how to perform nearby search using Android and many more is explained in detail with steps.
2. Contents
What is Google Location Service (Map)?
Introduction
Graphics in Google Map API
Attribution Requirements
Including google play service lib. into android project
Google Map API Key
Map Types
What provided in nearby search by Google Map
How to search nearby places using Android
3. What is google location service?
The google location service make it easy for developer
to build location-aware applications, without needing
to focus on the details of the underlying location
technology.
4. Introduction
With the Google Maps Android API, you can add maps
based on Google Maps data to your application.
The API automatically handles access to Google Maps
servers, data downloading, map display, and response
to map gestures.
5. Cont. . .
You can also use API calls to add markers, polygons,
and overlays to a basic map, and to change the user's
view of a particular map area. These objects provide
additional information for map locations, and allow
user interaction with the map.
6. Graphics in Google Map API
Icons anchored to specific positions on the map
(Markers).
Sets of line segments (Polylines) for drawing shapes.
Enclosed segments (Polygons), filled, unfilled or
hollow.
7. Cont. . .
Bitmap graphics anchored to specific positions on the
map (Ground Overlays).
Sets of images which are displayed on top of the base
map tiles (Tile Overlays).
8. Attribute Requirements
If you use the Google Maps Android API in your
application, you must include the Google Play
Services attribution text as part of a "Legal Notices"
section in your application. Including legal notices as
an independent menu item, or as part of an "About"
menu item, is recommended.
The attribution text is available by making a call to
GooglePlayServicesUtil.getOpenSourceSoftware
LicenseInfo.
9. Including google play service library
into android project
First you must add Google Play services as an Android
library project as follows:
Select File > Import > Android > Existing Android
Code Into Workspace and click Next.
Select Browse..., enter <android-sdk-
folder>/extras/google/google_play_services/libproject
/google-play-services_lib, and click Finish.
10. Google Map API Key
To access the Google Maps servers with the Maps API,
you have to add a Maps API key to your application.
The key is free, you can use it with any of your
applications that call the Maps API, and it supports an
unlimited number of users.
You obtain a Maps API key from the Google APIs
Console by providing your application's signing
certificate and its package name.
11. Cont. . .
Once you have the key, you add it to your application
by adding an element to your application's manifest
file AndroidManifest.xml.
Understanding the process of registering your
application and obtaining a key requires some
knowledge of Android's publishing process and
requirements.
12. Cont. . .
In summary, all Android applications must be signed
with a digital certificate for which you hold the private
key. Because digital certificates are unique, they
provide a simple way of uniquely identifying your app.
This makes them useful for tracking your application
in systems such as Google Play Store, and for
tracking your application's use of resources such as
the Google Maps servers.
13. Map Types
There are many types of maps available within the
Google Maps Android API. A map's type governs the
overall representation of the map. For example, an
atlas usually contains political maps that focus on
showing boundaries, and road maps that show all of
the roads for a city or region.
The Google Maps Android API offers four types of
maps, as well as an option to have no map at all: -
14. Cont. . .
Normal
Typical road map. Roads, some man-made features,
and important natural features such as rivers are
shown. Road and feature labels are also visible.
Hybrid
Satellite photograph data with road maps added.
Road and feature labels are also visible.
15. Cont. . .
Satellite
Satellite photograph data. Road and feature labels are
not visible.
Terrain
Topographic data. The map includes colours, contour
lines and labels, and perspective shading. Some roads
and labels are also visible.
16. What provided in nearby search by
Google Map
Airport
ATM
Bank
Bus Station
Train Station
Doctor
Hospital
Shopping Mall
Movie Theatre
Restaurant
Electrician
Plumber, Painter
There is total 96 types of filter for place searches.
17. How to Search Nearby Places with
Android App
Copy Library Project into Workspace
Get API Key from Developer Console
Add <meta-data> code to manifest file
Add Permissions into manifest file
Check Google Play Service is Available
Get Users Current Location
Send Request to Google Server for Nearby Places
Display Result using map/Listview
19. Get API Key from Developer Console
https://console.developers.google.com/project
1. Create New Project
2. Add Google Map API V2
3. Add Credentials
4. Create Android Key
5. Copy Generated API Key (for further usage)
33. Send Request to Google Server for Nearby
Places
StringBuilder sb = new StringBuilder
("https://maps.googleapis.com/maps/api/place/
nearbysearch/json?location="+ mLatitude + "," +
mLongitude + "&radius="+ distance
+"&sensor=true&key=yourApiKey="+type);
34. Send Request to Google Server for Nearby
Places
Café near by Vastrapur
https://maps.googleapis.com/maps/api/place/nearbyse
arch/json?location=23.0360,72.5294&radius=100&senso
r=true&key=APIKey&types=cafe