Showing current location in Google maps using API V2 with supportmapfragment

Source: Internet
Author: User
Tags reverse geocoding
Android applications

Intents And activities applications

Listview applications

Fragment applications

Styles and themes applications

Android action bar applications

Android action bar Sherlock applications

GPS and Google map applications

Chart (graph) Applications

Related posts
  • Google map Android API v2

    • Android
      Geocoding-showing user input location on Google map Android API v2

    • Google
      Map Android API v2-switching between normal view, satellite view and terrain View

    • Android
      Reverse geocoding at touched location in Google map Android API v2

    • Adding
      Marker on touched location of Google maps using Android API V2 with supportmapfragment

    • Google
      Maps in Android Application with new Google Maps Android API V2 using supportmapfragment

  • GPS
    • Android
      GPS with locationmanager to get current location-Example

    • Showing
      Current location in Google maps with GPS and locationmanager in Android

  • Map
    • Add
      Marker on touched location using Google map in Android-Example

    • Android
      Reverse geocoding using geocoder at touched location in Google Map

    • Android
      Geocoding-showing user input location on Google Map

  • System Service
    • Demonstrating
      The system service Notification Service and icationicationmanager by sending SMS using smsmanager in Android

Archives
  • March 2013 (4)
  • February 2013 (15)
  • January 1, 2013 (20)
  • December 2012 (16)
  • November 2012 (14)
  • October 2012 (25)
  • September 2012 (19)
  • August 2012 (26)
  • July 2012 (31)
  • Jun 2012 (31)
Showing current location in Google maps using API V2 with supportmapfragmentjanuary 5, 2013

By George

In this article, we will create an android application which will display current location in Google maps using Google Maps Android API V2.

Since the Google map is displayed usingSupportmapfragment, This application can run in Android API Level 8 or above.

In order to useMapfragmentFor Google Maps, we need Android device with API Level 12 or above.

This application is developed in eclipse 4.2.1 With ADT plugin (21.0.0) and Android SDK (21.0.0). This application is tested in a real Android phone with Android (2.3.6 ).

An alternative method for this application is available at showing
Current location using onmylocationchangelistener in Google map Android API v2

1. Download and configure Google Play Services library in eclipse

Google map for Android is now integrated with Google Play services. So we need to set up Google Play service library for developing Google map application in Android.

Please follow the given below link to setup Google Play service library in eclipse.

Http://developer.android.com/google/play-services/setup.html

2. Create a new Android Application project namely "locationingooglemapv2 ″

Figure 1: Create a new Android Application Project

3. Configure Android Application Project

Figure 2: Configure Project

4. design application launcher icon

Figure 3: designing application launcher icon

5. Create a blank Activity

Figure 4: Create a blank Activity

6. Enter main activity details

Figure 5: Enter main activity details

7. Link to Google Play service library

Figure 6: link Google Play Services library to this project

8. Get the API key for Google Maps Android API v2

We need to get an API key from Google to use Google Maps in Android Application. Please follow the given below link to get the API key for Google Maps Android API V2.

Https://developers.google.com/maps/documentation/android/start

9. Add Android support library to this project

By default, Android support library (android-support-v4.jar) is added to this project by Eclipse IDE to the directory libs. If it is not added, we can do it manually by doing the following steps:

  • Open project Explorer by clicking "Window-> show view-> Project explorer"
  • Right click this project
  • Then from popup window, click "android tools-> Add support library"

10. Update the file androidmanfiest. xml

12345678910111213141516171819202122232425262728293031323334353637383940414243444546 <?xml

version
="1.0"

encoding
="utf-8"?><manifest

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.