google map android v2 api-day9

Upload: shiva-kumar

Post on 02-Jun-2018

238 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Google Map Android v2 API-day9

    1/13

    1. Google Maps1.1 MapsView1.2 MapFragment1.3. Markers1.4. Changing the GoogleView1.5. Android emulator and Google Maps

    2. Install Google Play services3. Getting the Google Map key

    3.1. Overview3.2. Creating the SHA-1 for your signature key3.3. Register with the Google APIs Console

    3.4. Create key for your application4. Tutorial: Google Maps

    4.1. Create Project4.2. Adjust layout file4.3. Activity

    4.4. Run and Test

    http://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.htmlhttp://www.vogella.com/articles/AndroidGoogleMaps/article.html
  • 8/10/2019 Google Map Android v2 API-day9

    2/13

    Create a project with more than 3.0 version API

    Open Android Manifest file

    Copy Tag from google api link

    https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api

    paste between Tag

    https://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/start
  • 8/10/2019 Google Map Android v2 API-day9

    3/13

    Copy Tag fromgoogle api linkhttps://developers.google.com/maps/documentation

    /android/start#installing_the_google_maps_android_v2_api

    https://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/starthttps://developers.google.com/maps/documentation/android/start
  • 8/10/2019 Google Map Android v2 API-day9

    4/13

    Besides permissions required by other parts of your application, youmust add the following permissions in order to use the Google MapsAndroid API:

    android.permission.INTERNETUsed by the API to download map tiles fromG

    oogle Maps servers.

    android.permission.ACCESS_NETWORK_STATEAllows the API to check

    the connection status in order to determine whether data can bedownloaded.

    com.google.android.providers.gsf.permission.READ_GSERVICES Allows theAPI to access Google web-based services.

    android.permission.WRITE_EXTERNAL_STORAGEAllows the API to cachemap t

    ile data in the device's external storage area.

    The following permissions are recommended, but can be ignored if yourapplication does not access the user's current location, eitherprogrammatically, or by enabling the My Location layer.

    android.permission.ACCESS_COARSE_LOCATIONAllows the API to useWiFi

    or mobile cell data (or both) to determine the device's location.

    android.permission.ACCESS_FINE_LOCATIONAllows the API to use theG

    lobal Positioning System (GPS) to determine the device's location towithin a very small area.

    http://developer.android.com/reference/android/Manifest.permission.htmlhttp://developer.android.com/reference/android/Manifest.permission.htmlhttp://developer.android.com/reference/android/Manifest.permission.htmlhttp://developer.android.com/reference/android/Manifest.permission.htmlhttp://developer.android.com/reference/android/Manifest.permission.htmlhttp://developer.android.com/reference/android/Manifest.permission.htmlhttp://developer.android.com/reference/android/Manifest.permission.htmlhttp://developer.android.com/reference/android/Manifest.permission.htmlhttp://developer.android.com/reference/android/Manifest.permission.htmlhttp://developer.android.com/reference/android/Manifest.permission.html
  • 8/10/2019 Google Map Android v2 API-day9

    5/13

    Because version 2 of the Google Maps AndroidAPI requires OpenGL ES version 2, you must adda element as a child of

    theelement in AndroidManifest.xml:

    In particular, it has the effect of preventing Google

    Play Store from displaying your app on devicesthat don't support OpenGL ES version 2.

    Tag Paste in android manifest file

    http://developer.android.com/guide/topics/manifest/uses-feature-element.htmlhttp://developer.android.com/guide/topics/manifest/manifest-element.htmlhttp://developer.android.com/guide/topics/manifest/manifest-element.htmlhttp://developer.android.com/guide/topics/manifest/uses-feature-element.htmlhttp://developer.android.com/guide/topics/manifest/uses-feature-element.htmlhttp://developer.android.com/guide/topics/manifest/uses-feature-element.html
  • 8/10/2019 Google Map Android v2 API-day9

    6/13

    In main.xml, add the following fragment.

  • 8/10/2019 Google Map Android v2 API-day9

    7/13

    So open Eclipse IDE

    Help> instal new softwarehttp://keytool.sourceforge.net/update

    Copy this above link and paste it in the dialog box

    Check the keytool and click next >next .

    Accept the aggrement and then click finish.

    http://keytool.sourceforge.net/updatehttp://keytool.sourceforge.net/update
  • 8/10/2019 Google Map Android v2 API-day9

    8/13

    Open your google api console account.

    https://code.google.com/apis/console/

    Sign with your account.

    After signing in the right side select service

    And switch on Google Maps android api v2 = ON

    Again select API ACCESS in the down click

    [create new android key]You will get a dialog box to write you SHA1 KEY

    and package name.

  • 8/10/2019 Google Map Android v2 API-day9

    9/13

    For SHA1 fingerprint key got to theeclipse.And open keytool menu> openkeystore and click.

    Now you will get a dialog box and therebrowse up to debug .keystore in your systemand write password android then load.

    Copy the SHA1 finger print from the eclipse

    and copy in the google api console accountwith the project package name.

    79:C2:19:25:3A:96:7C:49:88:46:9F:18:14:78:D8:C4:09:B5:74:90;com.example.mapdemoproject

  • 8/10/2019 Google Map Android v2 API-day9

    10/13

    API key:AIzaSyBkHSorbwkcSIfT8ulq7Ks0t

    D60Wu-5cAQ

    Android apps:79:C2:19:25:3A:96:7C:49:88:46

    :9F:18:14:78:D8:C4:09:B5:74:9

    0;com.example.mapdemoproject

    Activated on: May 23, 2013 7:34 AM

    Activated by: [email protected]

  • 8/10/2019 Google Map Android v2 API-day9

    11/13

  • 8/10/2019 Google Map Android v2 API-day9

    12/13

    public class MainActivity extends FragmentActivity { private GoogleMap mMap;

    @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

    mMap = ((SupportMapFragment)

    getSupportFragmentManager().findFragmentById(R.id.map)) .getMap();

    }

  • 8/10/2019 Google Map Android v2 API-day9

    13/13

    Here we can Run this only on Real device.

    This map view cannot be seen in the emulator.

    So this is the way how we Develop GoogleAndroid Maps v2 version.