Hello all,
I'm new to android and need some help. I'm creating a basic Mapview
application which will display my current location on the google map.
Initially i had many doubts while creating the application, but thanks
to google archives that helped me to reach this point. I
have followed almost all the threads on the google site
but still unable to see my location on the google maps. It always
shows a white screen on the emulator with google image at the bottom.
Please help to make it work. From most of the threads I learn that we
need to sign our application with the correct fingerprint. I did so
but unsuccessful.
The following will explain the steps:
1. Using sdk version android-sdk-windows-1.0_r1
2. Created a new android application.
3. Signing the application:
a. C:\Program Files\Java\jdk1.6.0_13\bin>keytool.exe -list -alias
androiddebugkey -
keystore "D:\Profiles\fknq86\Local Settings\Application Data
\Android\debug.keyst
ore" -storepass android -keypass android
b. Certificate fingerprint (MD5):
75:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:33
where XX=some alpha numeric data
c. signing up for an Android Maps API key! using link
Sign Up for the Android Maps API - Android Maps API - Google Code
4. Code below: There are 2 applications 1. Find Me 2. ShowMyLoc.
FindMe has a button which directs it to ShowMyLoc (using Intent) to
show the location on the google maps. For simplicity sake i'm pasting
the code only for ShowMyLoc app.
//ShowMyLoc.java
Code:
package org.anddev.android.findme;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
public class ShowMyLoc extends MapActivity {
private Location myLocation;
protected MapView myMapView = null;
protected LocationManager myLocationManager = null;
protected MapController mapController;
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
@Override
protected void onCreate(Bundle icicle) {
// TODO Auto-generated method stub
super.onCreate(icicle);
this.myMapView = new MapView(this,
"0ZFOV5MY-5tIiNoVa_UiMuiMf39w_N6T5DalZzg");
this.setContentView(myMapView);
mapController = myMapView.getController();
mapController.setZoom(15);
this.myLocation = new Location("gps");
this.myLocation.setLongitude(77.52436144125092);
this.myLocation.setLatitude(13.05096452223662);
updateView();
}
private void updateView(){
Double lat = myLocation.getLatitude();
Double lng = myLocation.getLongitude();
GeoPoint point = new GeoPoint(lat.intValue(), lng.intValue());
mapController.setCenter(point);
}
//Menifest.xml
HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.anddev.android.findme"
android:versionCode="1"
android:versionName="1.0.0">
<uses-permission
android:name="android.permission.READ_CONTACTS" />
<uses-permission
android:name="android.permission.CALL_PHONE" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" /
>
<uses-permission
android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.ACCESS_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_ASSISTED_GPS" />
<uses-permission
android:name="android.permission.ACCESS_CELL_ID" />
<application android:icon="@drawable/icon"
android:label="@string/
app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".FindMe" android:label="@string/
app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
06-23 16:49:43.218: ERROR/vold(538): Error opening switch name path '/
sys/class/switch/test2' (No such file or directory)
06-23 16:49:43.218: ERROR/vold(538): Error bootstrapping switch '/sys/
class/switch/test2' (m)
06-23 16:49:43.218: ERROR/vold(538): Error opening switch name path '/
sys/class/switch/test' (No such file or directory)
06-23 16:49:43.218: ERROR/vold(538): Error bootstrapping switch '/sys/
class/switch/test' (m)
06-23 16:49:43.388: ERROR/flash_image(544): can't find recovery
partition
06-23 16:50:01.388: ERROR/MemoryHeapBase(572): error opening /dev/
pmem: No such file or directory
06-23 16:50:01.398: ERROR/SurfaceFlinger(572): Couldn't open /sys/
power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
06-23 16:50:01.468: ERROR/GLLogger(572): couldn't load <libhgl.so>
library (Cannot find library)
06-23 16:50:03.027: ERROR/GLLogger(572): couldn't load <libhgl.so>
library (Cannot find library)
06-23 16:50:07.187: ERROR/BatteryService(572): Could not open '/sys/
class/power_supply/usb/online'
06-23 16:50:07.196: ERROR/BatteryService(572): Could not open '/sys/
class/power_supply/battery/batt_vol'
06-23 16:50:07.207: ERROR/BatteryService(572): Could not open '/sys/
class/power_supply/battery/batt_temp'
06-23 16:50:07.748: ERROR/EventHub(572): could not get driver version
for /dev/input/mouse0, Not a typewriter
06-23 16:50:07.786: ERROR/EventHub(572): could not get driver version
for /dev/input/mice, Not a typewriter
06-23 16:50:08.007: ERROR/System(572): Failure starting core service
06-23 16:50:08.007: ERROR/System(572): java.lang.SecurityException
06-23 16:50:08.007: ERROR/System(572): at
android.os.BinderProxy.transact(Native Method)
06-23 16:50:08.007: ERROR/System(572): at
android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:
146)
06-23 16:50:08.007: ERROR/System(572): at
android.os.ServiceManager.addService(ServiceManager.java:72)
06-23 16:50:08.007: ERROR/System(572): at
com.android.server.ServerThread.run(SystemServer.java:163)
06-23 16:50:08.026: ERROR/AndroidRuntime(572): Crash logging skipped,
no checkin service
06-23 16:50:09.808: ERROR/LockPatternKeyguardView(572): Failed to bind
to GLS while checking for account
06-23 16:50:17.707: ERROR/ApplicationContext(572): Couldn't create
directory for SharedPreferences file shared_prefs/wallpaper-hints.xml
06-23 16:50:30.306: ERROR/MediaPlayerService(542): Couldn't open fd
for content://settings/system/notification_sound
06-23 16:50:30.326: ERROR/MediaPlayer(572): Unable to to create media
player
06-23 16:50:19.677: ERROR/ActivityThread(612): Failed to find provider
info for android.server.checkin
06-23 16:50:21.698: ERROR/ActivityThread(612): Failed to find provider
info for android.server.checkin
06-23 16:50:21.877: ERROR/ActivityThread(612): Failed to find provider
info for android.server.checkin
06-23 16:50:50.367: ERROR/AndroidRuntime(719): ERROR: thread attach
failed
06-23 16:51:19.426: ERROR/ActivityThread(748): Failed to find provider
info for com.google.settings
06-23 16:51:21.687: ERROR/MapActivity(748): Couldn't get connection
factory client
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---