Category Archives: Google Maps

Android Google Map V2 – Use Multiple Maps in Application

Hi All,

Since last few days I was facing serious problem with using multiple Google Maps in a Android application project I am currently working on. The application is a true copy of already existing app and used same source code to build with some changes as per client requirement.

Recently I came to know that Google has stopped user from generating Map API keys for Google Map V1Ā  hence I forced to use the latest available version. The application I am working on needed to look same as its iPhone counterpart so I used Tab Host/Activity in it.

The application started throwing issues when I used the latest version of Google Maps for Android. The problem was I had two map in the application and when I switched to 2nd Map screen from first one, the 2nd map did not work and showed same screen (map location) as 1st map screen. It accepted no user input i.e. no location change, zoom or pan.

It took me a lot of time to figure out a solution for this issue (almost 7 days), in between I found many people said it was due to Tab Host/Activity (I am not sure of it), some also suggested to use TabFragments but that did not work for me.

Solution

Finally I cam across an article on Google documents that discussed adding Maps on Android from code instead of XML and that did the trick for me. I added maps on both screen from code behind, but with this I also had to remove the map on the “OnPause” event of the Activity and re-initialize it on the “OnResume” event

I have created a sample android application that uses the solution, download it here

Note: You will need to change the Map API Key in the manifest file

Feel free to contact me in case of any problem

Cheers,

Ankit

Drag & Drop Pin on Map for Your Android Application

Hi all, I am very excited as I am very close to finish my first Android Application project.

From the past few days I have been working on it and truly this project has helped me learn a variety of stuffs including using various controls, external libraries, animations & my favorite Maps in android application. Personally I feel Map makes any application much smarter.

This application I have been developing uses Map to point users current location and it also allows to drag and drop the pin to any other location on the map and get address details for the position.

I love the way Drag & Drop Pin feature works on apple products (IPhone, IPod & IPad), specially the bouncy feeling it has and I wanted my application to have the same feel, but my bad, after searching for sometime on google I found that Google has not provided similar inbuilt feature for Android [I wonder why?], see the article here.

But as said in IT industry if client want it, it has to happen šŸ˜‰ so after some more search I found another article that mentioned about a sample project which shows similar feature, see the article here. So I used the sample project and achieved the desired result. Though it does not have the same bouncy feel but it look good and satisfies the requirement.

I have created a sample Android project for everyone who may have similar requirement after now and also attached the source code for Android project here below.

Download Source : Drag & Drop Pin for Android App

Please feel free to contact me in case you face any problem, thanks for reading šŸ˜‰

Google Maps Javascript API V3 Example

Google Maps – one of the best resource available on the web that brings the world on your computer screen. With google maps distant places are just a few clicks away from you.

Google maps javascript api is amongst the most widely used api on the web as it easilyĀ lets you embed Google Maps in your own web pages. Version 3 or V3 as its calledĀ of this API is especially designed to be faster and more applicable to mobile devices, as well as traditional desktop browser applications.

New Features

1. You can now specify the inclusion of optional libraries for specialized functionality in the Maps API!

2. Add animations to your markers! Make your markers drop or bounce when placed on the map.

3. The Google Maps API no longer requires a Maps API key!

4. The Google Static Maps service now supports custom styled maps!

Google Geocoding/Reverse GeocodingĀ Service

Geocoding is the process of converting addresses (like “Taj mahal Agra, Tajganj, Agra, Uttar Pradesh 282001, India“) into geographic coordinates (like latitudeĀ 27.173006 and longitude 78.042086), which you can use to place markers or position the map.

The Google Geocoding API provides a direct way to access a geocoder via an HTTP request. Additionally, the service allows you to perform the converse operation (turning coordinates into addresses); this process is known as “reverse geocoding.”

I have created a sample applicationĀ “Map My Address”Ā for those those who want to start using Google Maps on the web pages.

Sample URL: http://ankitkedia.com/sample/GoogleMaps/index.html

Download Source: http://ankitkedia.com/sample/GoogleMaps/source.zip

Please feel free to download and use the source code or contact me if you have any queries.