=> I'm using following MapView in my layout:-

    ------------------------------------------------------------

<com.google.android.gms.maps.MapView
    android:id="@+id/map"
    class="com.google.android.gms.maps.MapFragment"
    android:layout_width="match_parent"
    android:layout_height="190dp"
    android:layout_gravity="bottom"
    android:layout_marginTop="5dp"
    android:layout_marginBottom="10dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_below="@+id/ivLocation"
    android:padding="1dp"
    android:background="#D3D3D3"
    map:liteMode="true"
  />

=> I have the following code in onCreateView() of fragment:-

---------------------------------------------------------------------------------------

MapsInitializer.initialize(this.getActivity());
mapView = (MapView) view.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
mapView.setClickable(false);


=> And i also have the following code in the fragment class :-

----------------------------------------------------------------------------------------

@Override
public void onPause() {
    super.onPause();
    mapView.onPause();
}

@Override
public void onDestroy() {
    super.onDestroy();
    mapView.onDestroy();
}

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    mapView.onSaveInstanceState(outState);
}

@Override
public void onLowMemory() {
    super.onLowMemory();
    mapView.onLowMemory();
}

@Override
public void onResume() {
    super.onResume();
    mapView.onResume();
}

@Override
public void onDestroyView() {
    super.onDestroyView();
}

@Override
public void onMapReady(GoogleMap googleMap) {
    map = googleMap;
    if (ActivityCompat.checkSelfPermission(getContext(), 
android.Manifest.permission.ACCESS_FINE_LOCATION) != 
PackageManager.PERMISSION_GRANTED && 
ActivityCompat.checkSelfPermission(getContext(), 
android.Manifest.permission.ACCESS_COARSE_LOCATION) != 
PackageManager.PERMISSION_GRANTED) {
        // TODO: Consider calling
        //    ActivityCompat#requestPermissions
        // here to request the missing permissions, and then overriding
        //   public void onRequestPermissionsResult(int requestCode, String[] 
permissions,
        //                                          int[] grantResults)
        // to handle the case where the user grants the permission. See the 
documentation
        // for ActivityCompat#requestPermissions for more details.
        return;
    }
    map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    LocationManager locationManager = (LocationManager) 
getContext().getSystemService(Context.LOCATION_SERVICE);
    Location lastLocation = 
locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
    LatLng latLng = new LatLng(lastLocation.getLatitude(), 
lastLocation.getLongitude());
    googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 16));
    map.addMarker(new MarkerOptions().position(latLng).title("City Coordinator 
location at 
login").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW)));
    map.getUiSettings().setMapToolbarEnabled(false);
}


This code is working in moto e2 phone with lollipop android, but not 
working in moto g3 phone with marshmallow android. In marshmallow, map is 
not loading at all in googlemap lite mode. If i remove this attribute( 
map:liteMode="true") in mapview, map is loading but marker is not present.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/30a54694-c963-4a8b-b1a6-e4e13cfa92a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to