Why the maps and location not working on device one plus one (Marshmallow), but in other device (I try in Kitkat and lollipop it's working)? so that can't detect our location
this is my code
private void setMap() {
mMapFragment.getMapAsync(this);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
Place place = PlacePicker.getPlace(getApplicationContext(), data);
LatLng latLng = new LatLng(place.getLatLng().latitude, place.getLatLng().longitude);
googleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
googleMap.animateCamera(CameraUpdateFactory.zoomTo(15));
}
}
}
@Override
public void onMapReady(GoogleMap googleMap) {
this.googleMap = googleMap;
this.googleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
GoogleMapOptions option = new GoogleMapOptions();
option.compassEnabled(true);
this.googleMap.setTrafficEnabled(true);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
googleMap.setMyLocationEnabled(true);
googleMap.setOnMyLocationChangeListener(myLocationChangeListener);
}
private OnMyLocationChangeListener myLocationChangeListener = new OnMyLocationChangeListener() {
@Override
public void onMyLocationChange(Location location) {
if(awal) {
awal=false;
googleMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(location.getLatitude(), location.getLongitude())));
googleMap.animateCamera(CameraUpdateFactory.zoomTo(13));
}
}
};