Step 1:Create Map Key:
Open the comment prompt and change path:
Refer the path your installed java location:C:\Program Files\Java\jdk1.6.0_25\bin>
And Mentioned your "debug.keystore" file from .android folder in \Documents and Settings or Users :"C:\Documents and Settings\Administrator.SOFFEL.000\.android\debug.keystore"
And Enter the following comment:
Then copy the MD5 fingerprint and signup to Google :https://developers.google.com/android/maps-api-signup
Then agree and click Generate API Key.
Then copy the code and paste in main.xml file
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/bottomlayout"
android:layout_below="@+id/tablayout"
android:apiKey="0BBBs0Kl61EFEtpuR4whpWTjJjj4PqcuaRvScvQ"
android:clickable="true"
android:enabled="true" />
Java class:
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
public class AndroidGoogleMapsActivity extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Displaying Zooming controls
MapView mapView = (MapView) findViewById(R.id.mapView);
mapView.setBuiltInZoomControls(true);
}
}
Don't forget add internet permission and Google library in Manifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidhive.googlemaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<!-- Add Google Map Library -->
<uses-library android:name="com.google.android.maps" />
<activity
android:label="@string/app_name"
android:name=".AndroidGoogleMapsActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Open the comment prompt and change path:
Refer the path your installed java location:C:\Program Files\Java\jdk1.6.0_25\bin>
And Mentioned your "debug.keystore" file from .android folder in \Documents and Settings or Users :"C:\Documents and Settings\Administrator.SOFFEL.000\.android\debug.keystore"
And Enter the following comment:
C:\Program Files\Java\jdk1.7.0_02\bin> keytool.exe -list -alias androiddebugkey -
keystore "C:\Documents and Settings\Administrator.SOFFEL. 000\.android\debug.keys
tore" -storepass android -keypass android
Then copy the MD5 fingerprint and signup to Google :https://developers.google.com/android/maps-api-signup
Then agree and click Generate API Key.
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/bottomlayout"
android:layout_below="@+id/tablayout"
android:apiKey="0BBBs0Kl61EFEtpuR4whpWTjJjj4PqcuaRvScvQ"
android:clickable="true"
android:enabled="true" />
Java class:
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
public class AndroidGoogleMapsActivity extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Displaying Zooming controls
MapView mapView = (MapView) findViewById(R.id.mapView);
mapView.setBuiltInZoomControls(true);
}
}
Don't forget add internet permission and Google library in Manifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidhive.googlemaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<!-- Add Google Map Library -->
<uses-library android:name="com.google.android.maps" />
<activity
android:label="@string/app_name"
android:name=".AndroidGoogleMapsActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
No comments:
Post a Comment