Google Map Implementation in Real Device.
Obtaining a Maps API key
To apply for a key, you need to follow the series of steps outlined below. You can also refer to Google's detailed documentation on the process
at http://code.google.com/android/toolbox/apis/mapkey.html.
For deploying to a real Android device
eg:
In command prompt......
E:\Program Files\Java\jdk1.6.0_23\bin>keytool -v -list -keystore
"Drive E:\Folder\key" -storepass <Enter Password while Export the App> -keypass <Enter Password while Export the App>
......-------------------------------------------
After that you will get MD5 Key---
Now open your browser and go to the following url...
http://code.google.com/intl/ja/android/maps-api-signup.html
Use any gmail account for getting the xml...
sample
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="xxxxxxxxxxxxfaKy-WzTMwok_w"
/>
Use this xml in your layout for getting map...
Java class should extend mapactivty
-------------------------------------------------
Use Internet permission
use <uses-library android:name="com.google.android.maps" /> inside application tag.
---------------------------------------------------------------------------------
Add Zoom Controls to a Map
The correct method is setBuiltInZoomControls.
MapView map = (MapView)findViewById(R.id.mapview);
map.setBuiltInZoomControls(true);
This will put the zoom controls in the bottom-center of the screen.
Note: your zoom controls only show up when you touch the screen, so you have to make sure that the map is clickable. Thus:
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mapview"
android:clickable="true"
android:apiKey="your key" />
-----------------------------------------------------------------------------
0 comments: