Presentation is loading. Please wait.

Presentation is loading. Please wait.

Adding Location Nasrullah. Adding Location Adding a Map Activity Obtaining a Map API Debug Key Adding a Map View Finding an Address with Google’s GeoCoder.

Similar presentations


Presentation on theme: "Adding Location Nasrullah. Adding Location Adding a Map Activity Obtaining a Map API Debug Key Adding a Map View Finding an Address with Google’s GeoCoder."— Presentation transcript:

1 Adding Location Nasrullah

2 Adding Location Adding a Map Activity Obtaining a Map API Debug Key Adding a Map View Finding an Address with Google’s GeoCoder Returning the choosen from the map Activity.

3 Task Manager I.Find an Address II.Choose the Address to add a Task

4 Cast of Characters MapView- A Google Map,just like the official Maps Application MapActivity- An Activity that knows how to display the MapView GeoCoder- a class that can search for a location,returning an address with latitude and longitude.

5 Step one- Adding a Location

6 Add Location Steps

7 Step 2Map View On the Screen

8 Obtaining a Google API key To use Google Map’s API you need an API key One Production key and many debug keys – One debug key for every developer machine – https://developers.google.com/maps/documentat ion/android/mapkey https://developers.google.com/maps/documentat ion/android/mapkey

9 My Debug key

10

11

12 Step 2- Map View Steps You also requried INTERNET Permission for that app

13 Step 3-Finding an Address

14 Geocoder Returns List getFromLocation-search for addresses near longitude and latitude getFromLocationName-search for a location by name getFromLocationName-search for a location within a “geofence” –a box defined by longitude and latitude

15 Finding and Displaying an Address Steps

16 Step 4 Returning the address to the AddTaskActivity

17 Step 4 –Returning an address

18 Returning an Address Steps

19 Longitude*1E6 The reason they are multiplied by 1E6 is because the GeoPoint class (which is used to plot points on a Google Map) uses microdegree latitude and longitude as integers. Multiplying by 1E6 converts degrees into microdegrees. The reason Google chose to do it this way is up to debate, but it probably has to do with the fact that the Google Maps themselves are not extremely accurate, and using a raw double value to 10 or more decimal places returned by the GPS is an unnecessary level of accuracy to plot a point on a Google Map. SOURCE http://stackoverflow.com/questions/6125476/android- google-maps-longitude-latitude-calculation-question http://stackoverflow.com/questions/6125476/android- google-maps-longitude-latitude-calculation-question

20 GeoPoint 1)First you have data(Location) in degree formate. 2)By the Equation you have to multiply it by 1000000 3)now,you have particular GEO POINT Location. if you have location like : Latitude:23.0395677 and Longitude:72.5660045° So, your GeoPoint(23039568,72566045); float lat = -23.4456f; float lng = 45.44334f; GeoPoint gp = new GeoPoint((int)(lat * 1E6), (int)(lng * 1E6));

21 What we did? Added a map Activity Got a Debug key Added a MapView Used GeoCoder to find an Address Displayed the address returned from the map activity.


Download ppt "Adding Location Nasrullah. Adding Location Adding a Map Activity Obtaining a Map API Debug Key Adding a Map View Finding an Address with Google’s GeoCoder."

Similar presentations


Ads by Google