As a prerequisite, you need to install the Android SDK. See Get the Android SDK.
The Google Maps Android API v2 is distributed as part of the Google Play services SDK. You can download the Google Play services SDK via the Android SDK Manager.
To test your app when using the Google Play services SDK, you must use either:
To import the Google Play Services into your workspace , first create a android project from existing resource.Then goto path ..sdk/extra/google/googleplayservice.
Then copy the project in to the workspace..
After you’ve added the Google Play services library as a dependency for your app project, open your app’s manifest file and add the following tag as a child of the
[code lang=”js”]
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
[/code]
Maps API keys are linked to specific certificate/package pairs, rather than to users or applications. You only need one key for each certificate, no matter how many users you have for an application. Applications that use the same certificate can use the same API key. However, the recommended practice is to sign each of your applications with a different certificate and get a different key for each one.
Obtaining a key for your application requires several steps.
Enter your SHA-1 fingerprint and the package of your application separated by a semicolon. For example you can use the org.aynsoft.mapDummy package.
Follow the steps below to include the API key in your application’s manifest, contained in the file AndroidManifest.xml. From there, the Maps API reads the key value and passes it to the Google Maps server, which then confirms that you have access to Google Maps data.
[code lang=”js”]
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
[/code]
Substitute your API key for API_KEY in the value attribute. This element sets the keycom.google.android.maps.v2.API_KEY to the value of your API key, and makes the API key visible to anyMapFragment in your application.
Specify the permissions your application needs, by adding
[code lang=”js”]
<uses-permission android:name="permission_name"/>
[/code]
For example, to request the Internet permission, add:
[code lang=”js”]
<uses-permission android:name="android.permission.INTERNET"/>
[/code]
Besides permissions required by other parts of your application, you must add the following permissions in order to use the Google Maps Android API:
[code lang=”js”]
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
[/code]
[code lang=”js”]
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
[/code]
[code lang=”js”]
package com.example.mapdemo;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
[/code]
Build and run your application. You should see a map. If you don’t see a map, confirm that you’ve completed all the steps described on this page.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Over the years we have developed several Google Map, mashups Android and iPhone components, code modules and Frameworks that can work as plug and play solutions for developing new apps that will substantially reduce the app development cost and time.
Contact us to discuss your multimedia mobile application development project.
Tags: Google Maps for Android
Warning: _() expects exactly 1 parameter, 2 given in /home2/mobilemeri7/public_html/wp-content/themes/mobilemerit/comments.php on line 28