GeoLocation using Google Maps
JavaScript API v3
Steps
Manifest Permission
Challenges and Limitation
•Some API is not work in Emulator•Internet connection must need•Complex Coding•Some APIs is not suitable for most of the countries like Bangladesh.
Solutions•Use Real Devices•Keep connect internet in your testing device
•Need a good knowledge of JS•Use the other APIs which are very popular
Google Maps JavaScript API v3
Amuture•Obtaining an API Key•Declaring Your Application as HTML5•Loading the Google Maps API•Map DOM (Document Object Model) Elements•Map Options•The Map Object•Loading the Map
Obtaining an API Key
Sample Code
Map DOM Elements
This This div will show the map.will show the map.
Loading the Google Maps API
This This script’s src is the is the Google Map APIGoogle Map API
Libraries Call
This This script willwill initialize the map the map
Loading the Map
This will load the This will load the mapmap
Intermediate
Simple Marker
Custom Icon
Dragging
Polylines
Polygon
Open an info window
Open an info window manual Width
Advance
My GeoLocation
GPS is must for this option.
Nearby Search Requests
Radar Search Requests
Directions API and Distance API
Status Codes
• ERROR: There was a problem contacting the Google servers.
• INVALID_REQUEST: This request was invalid.
• OK: The response contains a valid result.• OVER_QUERY_LIMIT: The webpage has
gone over its request quota.• NOT_FOUND The referenced location was
not found in the Places database.• REQUEST_DENIED: The webpage is not
allowed to use the PlacesService.• UNKNOWN_ERROR: The PlacesService
request could not be processed due to a server error. The request may succeed if you try again.
• ZERO_RESULTS: No result was found for this request.
Search Responses
Place Details Responses
• ERROR: There was a problem contacting the Google servers.
• INVALID_REQUEST: This request was invalid.
• OK: The response contains a valid result.• OVER_QUERY_LIMIT: The webpage has
gone over its request quota.• REQUEST_DENIED: The webpage is not
allowed to use the PlacesService.• UNKNOWN_ERROR: The PlacesService
request could not be processed due to a server error. The request may succeed if you try again.
• ZERO_RESULTS: No result was found for this request.
References•https://console.developers.google.com/•https://developers.google.com/maps/documentation/javascript/
•https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
Any Questions ???
Top Related