FRIST GO TO BIN FILE WHERE YOUR JAVA SDK IS LOAD THEN AFTER
OPEN COMMAND PROMPT GET HEX CODE
LIKE :
C:\PROGRAM\JAVA\BIN>_
AFTER GO TO
command
---------------------
keytool -list -alias androiddebugkey -keystore "C:\test\debug.keystore" -storepass android -keypass android
for my application
=======================
keytool -list -alias androiddebugkey -keystore "C:\Users\user\.android\debug.keystore" -storepass android -keypass android
hex code that are generate from the cmd after entering the key tool command
=========
1D:8B:B1:5E:C4:22:E7:38:C0:9C:D3:10:2C:28:6E:87
////////////////////////////////
USE THIS LINK FOR GET CERTIFICATE ( MAKE SURE IF YOU HAVE ANY GMAIL ACCOUNT THEN YOU CAN SIGN ONLY )
LINK:http://code.google.com/android/maps-api-signup.html
AND PUT THE CODE AND GET CERTIFICATE AND PUT
SPECIFIC PART OF THE APPLICATION
cretificate:
0JoaYaVSWTJ1d58mSUjIZyorxPA0cz7F2amPJQQ
////////////////
in manifast add uses libary//
com.google.android.maps
use android code
============
make mapActivity name for frist activity and extend mapactivity and package : com.myandroid.map;
target set google APIs 8 :
cade :
=======
package com.myandroid.map;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
public class mapActivity extends MapActivity {
MapController mc;
GeoPoint p;
MapView mapView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapView);
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.layout_zoom);
// mapView.setEnabled(true);
// mapView.setSatellite(true);
mapView.setStreetView(true);
mapView.getZoomControls();
// mapView.displayZoomControls(true);
@SuppressWarnings("deprecation")
View zoomView = mapView.getZoomControls();
zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mc = mapView.getController();
String coordinates[] = {"1.352566007", "103.78921587"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
p = new GeoPoint(
(int) (lat * 1E6),
(int) (lng * 1E6));
mc.animateTo(p);
mc.setZoom(17);
mapView.invalidate();
Geocoder geoCoder = new Geocoder(this, Locale.getDefault());
try {
List<Address> addresses = geoCoder.getFromLocationName(
"empire state building", 5);
String add = "";
if (addresses.size() > 0) {
p = new GeoPoint(
(int) (addresses.get(0).getLatitude() * 1E6),
(int) (addresses.get(0).getLongitude() * 1E6));
mc.animateTo(p);
mapView.invalidate();
}
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
//////////////////////////////////////// XML //////////////
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0JoaYaVSWTJ1d58mSUjIZyorxPA0cz7F2amPJQQ"
/>
<LinearLayout android:id="@+id/layout_zoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
/>
</LinearLayout>
////////////////////////////////////////////////////////////
User permission :
Internet add in project manifest
No comments:
Post a Comment