Friday, April 11, 2014

How to use Android Google Maps(API Ver2) in older Android version such as 2.3.(Part 1/2)

1. Install google play service package.
  • Go to Android SDK manager.
  • Select Google Play services under Extras and click 'Install packages' button.
 
  • Accept License agreement and click 'Istall' button.
 2. Import the downloaded google play service.
  • Select file>Import>Android>Existing Android Code Into Workspace in eClipse.
  • Click 'Browse...' button and select google play service folder(adt home>sdk>extras>google>google_play_service).
  • Select google-play-services_lib and click 'Finish' button.
  • You can now see 'google-play-services_lib' project in Package Explore in eClipse.
3. Load 'google-play-services_lib' to your project.
  • select Project>properties and go to Android.
  • In the Library box click 'Add...' button.
  • select 'google-play-services_lib' on the popup and click 'ok' button. 
  

 4. Obtain Android Google Maps V2 API key.
  • go to Window>Preferences and select Android>Build.
  • Copy SHA1 fingerprint.(You can also get it from command line using keytool.)
  • go to google cloud console(https://cloud.google.com/console).
  • Create project if you don't have on yet.
  • Switch on Google Maps Android API v2 in APIs & Auth>APIs.
  • go to APIs & auth>Credentials and click 'Create New Key' button under Public API access.
  • Select Android Key in the 'Create New Key' popup.
  • Insert SHI;Your Package Name as instructed. ex) 45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:12:17:F2:56:26:A0:E0;com.example.googlemaptest
  • The package name should be in the AndroidManifest.xml of your app project.
  • Copy the API key created and add it as a meta-data in the AndroidManifest.xml of your app project as below.
<application
android:name=...>
      <meta-data android:name="com.google.android.maps.v2.API_KEY"
                    android:value="AIasdfsvsdfe9UzZtZVnuZTJy2SSDFSDFF3" />



No comments:

Post a Comment