/ / ACCESS_FINE_LOCATION chyba v MapActivity - android

ACCESS_FINE_LOCATION chyba v MapActivity - android

  ACCESS_FINE_LOCATION,...works in the first line but not in Second

if (ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_FINE_LOCATION)! = PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_COARSE_LOCATION)! = PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions (DriverMap.this, nový reťazec [] {Manifest.permission.ACCESS_FINE_LOCATION}, LOCATION_REQUEST_CODE); }

ACCESS_FINE_LOCATION nie je identifikovateľný v druhom riadku

odpovede:

0 pre odpoveď č. 1

Vyzerá to, že ste zabudli android. kvalifikácia v druhom prípade ACCESS_FINE_LOCATION, Opravená verzia znie:

if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(DriverMap.this , new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},LOCATION_REQUEST_CODE);
}