- Forum-Beiträge: 103
01.12.2014, 18:13:51 via Website
01.12.2014 18:13:51 via Website
Hallo,
suche verzweifelt nach der Ursache dafür, dass ich bei meiner Google Maps-Anwendung keine Karte zu sehen bekomme.
Einen API-Key habe ich heute neu erzeugt bei Google.
Unmittelbar nach onResume kommt im Log-Protokoll eine Flut von Anzeigen mit der wahrscheinlich wichtigen "Couldn't get connection factory client".
Log-Ausschnitt:
12-01 13:58:10.837: D/** ALLPROVIDER(1614): passive --- isProviderEnabled(): true
12-01 13:58:10.837: D/* ALLPROVIDER(1614): requiresCell(): false
12-01 13:58:10.837: D/* ALLPROVIDER(1614): requiresNetwork(): false
12-01 13:58:10.847: D/* ALLPROVIDER(1614): requiresSatellite(): false
12-01 13:58:10.857: D/* ALLPROVIDER(1614): gps --- isProviderEnabled(): true
12-01 13:58:10.857: D/* ALLPROVIDER(1614): requiresCell(): false
12-01 13:58:10.857: D/* ALLPROVIDER(1614): requiresNetwork(): true
12-01 13:58:10.857: D/* ALLPROVIDER(1614): requiresSatellite(): true
12-01 13:58:10.867: D/* ALLPROVIDER(1614): network --- isProviderEnabled(): false
12-01 13:58:10.867: D/* ALLPROVIDER(1614): requiresCell(): true
12-01 13:58:10.877: D/* ALLPROVIDER(1614): requiresNetwork(): true
12-01 13:58:10.877: D/* ALLPROVIDER(1614): requiresSatellite(): false
12-01 13:58:10.897: I/* LocationDemo2(1614): onStart, NETWORK/GPS-PROVIDER==false/true
12-01 13:58:10.917: I/* LocationDemo2(1614): onStart(2)
12-01 13:58:10.927: I/*** LocationDemo2(1614): onResume()
12-01 13:58:11.077: D/libEGL(1614): loaded /system/lib/egl/libEGL_emulation.so
12-01 13:58:11.107: D/(1614): HostConnection::get() New Host Connection established 0x2a147b48, tid 1614
12-01 13:58:11.128: D/libEGL(1614): loaded /system/lib/egl/libGLESv1_CM_emulation.so
12-01 13:58:11.137: D/libEGL(1614): loaded /system/lib/egl/libGLESv2_emulation.so
12-01 13:58:11.188: W/EGL_emulation(1614): eglSurfaceAttrib not implemented
12-01 13:58:11.207: D/OpenGLRenderer(1614): Enabling debug mode 0
12-01 13:58:11.276: I/MapActivity(1614): Handling network change notification:CONNECTED
12-01 13:58:11.276: E/MapActivity(1614): Couldn't get connection factory client
12-01 13:58:11.516: D/dalvikvm(1614): GC_FOR_ALLOC freed 45K, 8% free 2911K/3152K, paused 54ms, total 63ms
12-01 13:58:12.007: W/System.err(1614): IOException processing: 26
12-01 13:58:12.007: W/System.err(1614): java.io.IOException: Server returned: 3
12-01 13:58:12.047: W/System.err(1614): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
12-01 13:58:12.047: W/System.err(1614): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
12-01 13:58:12.067: W/System.err(1614): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
12-01 13:58:12.067: W/System.err(1614): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
12-01 13:58:12.107: W/System.err(1614): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
12-01 13:58:12.107: W/System.err(1614): at java.lang.Thread.run(Thread.java:856)
12-01 13:58:12.147: D/dalvikvm(1614): GC_CONCURRENT freed 95K, 8% free 3225K/3468K, paused 6ms+44ms, total 266ms
12-01 13:58:12.477: W/System.err(1614): IOException processing: 26
Anbei die Dateien Manifest, Layout und Activity. Habe in den xml-Dateien Protokoll entfernt, da das beim Abschicken bemängelt wurde.
Mein Gerät: Samsung GT-I8190
Bitte um Hilfe !
Gruß Wicki
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="schemas.android.com/apk/res/android"
package="com.thomaskuenneth.locationdemo2" android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.thomaskuenneth.locationdemo2.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".LocationDemo2" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="6dp" >
<Button
android:id="@+id/button"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:text="@string/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/buttonSchochwitz"
android:text="@string/buttonSchochwitz"
android:layout_toRightOf="@id/button"
android:layout_alignTop="@id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.maps.MapView
xmlns:android="schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_above="@id/button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="mein api-key" />
</RelativeLayout>
package com.thomaskuenneth.locationdemo2; //import's public class LocationDemo2 extends MapActivity { private static final String TAG = "**** "+LocationDemo2.class.getSimpleName(); private LocationManager manager; private LocationListener listener; private MapController mapController; MapView mapView; GeoPoint geoPoint; GeoPoint lastpoint; boolean network = false; //Koordinaten übers Netzwerk (false: GPS) String prov=""; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); new Log("Logfile.txt"); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { showCurrentLocation(); } }); Button buttonSchochwitz = (Button) findViewById(R.id.buttonSchochwitz); buttonSchochwitz.setOnClickListener(new OnClickListener() { public void onClick(View v) { double d1 = Location.convert("049:27");//"051:31:47"); double d2 = Location.convert("011:05");//"011:44:46"); geoPoint = new GeoPoint((int)(d1*1E6), (int)(d2*1E6)); Location loc = new Location(prov); if (prov=="") return; loc.setLatitude(d1); loc.setLongitude(d2); String zo = Location.convert(loc.getLongitude(),Location.FORMAT_SECONDS); String za = Location.convert(loc.getLatitude(),Location.FORMAT_SECONDS); String message = String.format( "Current Location \n Longitude: %1$s \n Latitude: %2$s",zo,za ); Toast.makeText(LocationDemo2.this, message, Toast.LENGTH_LONG).show(); mapController.setCenter(geoPoint); mapController.animateTo(geoPoint); mapView.invalidate(); } }); // Location Manager ermitteln manager = (LocationManager) getSystemService(LOCATION_SERVICE); // LocationListener definieren listener = new LocationListener() { @Override public void onStatusChanged(String provider, int status, Bundle extras) { Log.i(TAG, "onStatusChanged()"); } @Override public void onProviderEnabled(String provider) { Log.i(TAG, "onProviderEnabled()"); Toast.makeText(LocationDemo2.this, "onProviderEnabled()", Toast.LENGTH_LONG).show(); } @Override public void onProviderDisabled(String provider) { Log.i(TAG, "onProviderDisabled()"); Toast.makeText(LocationDemo2.this, "onProviderDisabled()", Toast.LENGTH_LONG).show(); } @Override public void onLocationChanged(Location location) { Log.i(TAG, "onLocationChanged(1)"); Toast.makeText(LocationDemo2.this, "**** onLocationChanged()", Toast.LENGTH_SHORT).show(); // Koordinaten umwandeln int lat = (int) (location.getLatitude() * 1E6); int lng = (int) (location.getLongitude() * 1E6); geoPoint = new GeoPoint(lat, lng); // Log.i(TAG, "onLocationChanged(2)"); mapController.setCenter(geoPoint); mapController.animateTo(geoPoint); // mapController.zoomToSpan(lat, lng); } }; //Ende Listener // Zoom aktivieren mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); // MapController ermitteln mapController = mapView.getController(); } //Ende onCreate @Override protected void onStart() { super.onStart(); getAllPrv(); network=false; boolean gps=false; if (manager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { network=true; } if (manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { gps=true; } if (gps) { prov="gps"; manager.requestLocationUpdates(LocationManager.GPS_PROVIDER,3000, 0, listener); } else if (network) { prov="network"; manager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,3000, 0, listener); } String z="onStart, NETWORK/GPS-PROVIDER=="+network+"/"+gps; Log.i(TAG, z); Toast.makeText(LocationDemo2.this,z,Toast.LENGTH_LONG).show(); Log.i(TAG, "onStart(2)"); //fügt der MapView neues Overlay (zum zeichnen der 'current location') hinzu List overlays = mapView.getOverlays(); // overlays.clear(); overlays.add(new MyOverlay()); } protected void onResume() { super.onResume(); Log.i(TAG, "onResume()"); } @Override protected void onPause() { super.onPause(); Log.i(TAG, "onPause()"); manager.removeUpdates(listener); Toast.makeText(LocationDemo2.this, "**** onPause", Toast.LENGTH_LONG).show(); Log.close(); } protected void onDestroy() { super.onDestroy(); Log.i(TAG, "onDestroy()"); Toast.makeText(LocationDemo2.this, "**** on Destroy", Toast.LENGTH_LONG).show(); } @Override protected boolean isRouteDisplayed() { return false; } protected void showCurrentLocation() { Location location; if (prov=="network") location = manager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); else location = manager.getLastKnownLocation(LocationManager.GPS_PROVIDER); Location loc = location; String zws = ""; if (loc != null) { String lo = Location.convert(loc.getLongitude(),Location.FORMAT_SECONDS); String la = Location.convert(loc.getLatitude(),Location.FORMAT_SECONDS); String message = String.format(zws+ "Current Location \n Longitude: %1$s \n Latitude: %2$s",lo,la // location.getLongitude(), location.getLatitude() ); Log.i(TAG,message); Toast.makeText(LocationDemo2.this, message, Toast.LENGTH_LONG).show(); //To force a view to draw, call the invalidate() method, which is //implemented in the View class. Bewirkt u.a. das Zeichnen der //'current location'. } mapView.invalidate(); } void getAllPrv() { String TAG="**** ALLPROVIDER"; // Liste mit Namen aller Provider erfragen List providers = manager.getAllProviders(); // Infos zu Location Providern ausgeben for (String name : providers) { LocationProvider lp = manager.getProvider(name); Log.d(TAG, lp.getName() + " --- isProviderEnabled(): " + manager.isProviderEnabled(name)); Log.d(TAG, "requiresCell(): " + lp.requiresCell()); Log.d(TAG, "requiresNetwork(): " + lp.requiresNetwork()); Log.d(TAG, "requiresSatellite(): " + lp.requiresSatellite()); } } /* a private inner class which extends Overlay and override the draw method * zeichnet als 'overlay' den 'geoPoint' in die Karte */ private class MyOverlay extends com.google.android.maps.Overlay { @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, shadow); if (!shadow && geoPoint != null) { Point point = new Point(); //wird Koordinate des GeoPoint mapView.getProjection().toPixels(geoPoint, point); Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.marker_default); // Shift it left so the center of the image is aligned with the x-coordinate of the geo point int x = point.x - bmp.getWidth() / 2; // Shift it upward so the bottom of the image is aligned with the y-coordinate of the geo point int y = point.y - bmp.getHeight(); canvas.drawBitmap(bmp, x, y, null); } } } //Nur zur Protokollierung der Log's, wenn App auf dem Gerät läuft static class Log { static BufferedWriter writer; static boolean ok=true; public Log(String dateiName) { File datei; //data to sd-card or internal storage String dz="/storage/sdcard0/Documents/"+dateiName; //internal storage datei = new File(dz); boolean append=true; //true: Datei fortschreiben try { writer = new BufferedWriter(new FileWriter(datei,append)); writer.write("++++"+new Date()+"++++"); writer.newLine(); writer.newLine(); } catch (IOException e) { ok=false; return; } } static void i(String tag, String z) { try { if (!ok) { android.util.Log.i(tag,z); return; } writer.write(tag + " | "+z); writer.newLine(); } catch (IOException e) { e.printStackTrace(); } } static void d(String tag, String z) { try { if (!ok) { android.util.Log.d(tag,z); return; } writer.write(tag + " | "+z); writer.newLine(); } catch (IOException e) { e.printStackTrace(); } } static void close() { try { if (!ok) return; writer.close(); } catch (IOException e) { e.printStackTrace(); } } } }
— geändert am 01.12.2014, 18:33:30
Empfohlener redaktioneller Inhalt
Mit Deiner Zustimmung wird hier ein externer Inhalt geladen.
Mit Klick auf den oben stehenden Button erklärst Du Dich damit einverstanden, dass Dir externe Inhalte angezeigt werden dürfen. Dabei können personenbezogene Daten an Drittanbieter übermittelt werden. Mehr Infos dazu findest Du in unserer Datenschutzerklärung.