2016-07-31 6 views
0

Warum funktionieren die Karten und Standort nicht auf Gerät eins plus eins (Marshmallow), aber in anderen Gerät (ich versuche in Kitkat und Lollipop funktioniert es)? so kann das nicht unsere Position erkennenGoogle Maps funktioniert nicht auf Gerät eins plus eins (Marshmallow)

enter image description here

dies ist mein 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)); 
      } 
     } 
    }; 

Antwort

Verwandte Themen