Issue
After 30 hours of programming and failing at this, I realised I couldn't do what I wanted. So this is a last ditch effort to score a pass.
Trying to implement google api to show stuff on a map.
I've basically followed the Android tutorial entirely and it still refuses to work.
It just shows the grid on the MapView, my friend tested my api key so it should be fine.
The only permission I was supposed to use is
android.permission.INTERNET
I've seen the other thread, but I'm positive the key is fine and I think the permission is in the right place.
<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:clickable="true"
android:apiKey="key"
/>
</LinearLayout>
manifest
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:debuggable="false">
<uses-library android:name="com.google.android.maps" />
<activity
import java.util.List;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
public class Main extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker);
MyItemizedOverlay itemizedoverlay = new MyItemizedOverlay(drawable);
GeoPoint point = new GeoPoint(19240000,-99120000);
OverlayItem overlayitem = new OverlayItem(point, "Hola, Mundo!", "I'm in Mexico City!");
itemizedoverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedoverlay);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
seems I was premature, I built another key, exactly as I did last time. This time the key worked.
but now the problem is, when I click on zoom, it force closes teh application
Solution
dont use debug.keystore
. Use new keystore
. Right click on ur project>Android tools> Export signed application package
. Create new keystore (Remember alias name and password).
Now use following command in command prompt:
cd "C:\Program Files\Java\jdk1.7.0_01\bin
keytool -v -list -alias <ur alias name> -keystore <ur keystore name>.keystore -storepass android -keypass android
It asks for password
later it gives a MD5 fingerprint
Use that md5 fingerprint to generate google api key
. Replace the key.
Now Project Right Click>Android tools>Export Signed Application package>
Use existing keystore
select previous keystore and u get apk in release mode.
check installing this apk.It should run properly.
Answered By - Seshu Vinay
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.