Gelişmekte olduğum uygulamanın içinde bir harita görüntüsü alıyorum. Google konsolunda bir API anahtarını başarıyla oluşturdum ve izne izin ekledim ve bazı hatalar için logcat'i kontrol et ama hiçbir şey yok.Harita görünümüne V2 gösterilemiyor
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="it.previnet.mobile.dashboard.credem"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="23" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="it.previnet.mobile.dashboard.credem.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="it.previnet.mobile.dashboard.credem.permission.MAPS_RECEIVE" />
<application
android:allowBackup="true"
android:icon="@drawable/logo_credemvita"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".DashboardActivity"
android:label="@string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDfFnshaZgWuun842Z3wzGN4gqp2dj98ew" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
Ve burada kod: Burada
<LinearLayout
android:id="@+id/main_box_container2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/box_container2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:minWidth="450dp"
android:orientation="vertical" >
<TextView
android:id="@+id/geo_map_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/distribuzione_title"
android:textSize="28sp"
android:textStyle="bold" />
<com.google.android.gms.maps.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</com.google.android.gms.maps.MapView>
</LinearLayout>
</LinearLayout>
açıktır: Tüm Burada
düzenidir
protected void initMap(View geo) {
// Gets the MapView from the XML layout and creates it
mapView = (MapView) geo.findViewById(R.id.map_view);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap map) {
map.getUiSettings().setMyLocationButtonEnabled(true);
map.setMyLocationEnabled(true);
// Needs to call MapsInitializer before doing any CameraUpdateFactory calls
try {
MapsInitializer.initialize(this.getActivity());
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
}
// Updates the location and zoom of the MapView
LatLng latLng = new LatLng(43.1, -87.9);
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 10);
map.addMarker(new MarkerOptions().position(new LatLng(43.1, -87.9)).title("Marker"));
map.animateCamera(cameraUpdate);
}