BANGALORE, INDIA: This tutorial is intended for Java developers who are familiar withi Android development. The code within this tutorial will use version 1.1 of the Android SDK and the Google Maps API Version 3.
After completing this tutorial, you will have an application that loads a Google Map and centers it at the location provided by the Android device. To view the complete code for this article, see the gmaps-samples project on Google Code Hosting.
This tutorial is not meant as a complete introduction to Android development. For more information on getting started with Android, check out the Android Developers guide.
Why load a V3 page into a native app?
The Android development environment provides a lot of advantages to developers, including:
* Access to native services on the device, including location services
* Placement in the Android Market
* Rapid development using the Android SDK and Eclipse
Note that a native Android Google Maps API exists. Some developers, naturally will want to develop solely within that environment. However, these are some significant advantages to developing a Google Maps API page that lives on a server, not within the application.
* Rapid versioning: With a map application on your server, you can modify it quickly without launching an update in the Android Market. This removes the requirement for your users to download and install an update merely to get a new version of the map. Instead, they can get a new one any time they open your app.
* More frequent feature additions and bug fixes from Google: Instead of waiting for the next Android update, the Google Maps API can update on the server, without having to update on every device using your application.
* Cross-platform compatibility: Using the Maps API allows you to create a single map that runs on multiple platforms.
How it Works
Loading a web page into an Android application is done using a WebView. The WebView essentially embeds a browser into your app. The browser exposes controls to allow you to shape how you're loading the page. This embedded browser also allows you to expose a JavaScript to Java bridge, which gives you the capability to call Java methods in your native Android application from the JavaScript page. This WebView also allows you to make JavaScript calls directly from your Java application as well.
Once you've created a new empty Android Application, there are four essential components you have to modify or create to build your WebView.
1. Your layout. In this application, this is in the res/layout/main.xml file
2. The Android manifest file whcih helps you manage your permissions to use the Internet and the location services on the device.
3. A Java class to create and manage the WebViewactivity.
4. The map your application will load.
Click here to know each of the components which are described in detail...!
(Mano Marks, Google Geo APIs Team )
(The above article is taken from code.google.com under Creative commons licensing)