-1
Google지도에서 현재 위치를 표시 할 수 있도록 Android 휴대 전화에서 GPS 권한을 요청하고 있습니다. 우리는 매니페스트 태그에서 응용 프로그램 태그의 외부에서이 매니페스트, 포함했다 : 여기 MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION 코드에서 Android가 인식되지 않는 권한
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
가 작동하지 않는 우리의 코드의 일부를,이 인식되지 MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION :
if (ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
android.Manifest.permission.ACCESS_FINE_LOCATION)) {
// Show an explanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
} else {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION);
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
// app-defined int constant. The callback method gets the
// result of the request.
}
}
우리 또한 "import android.Manifest"도 포함되어 있습니다.
미리 감사드립니다.
public static int MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION =1;
는 다음과 같이 결과 잡기 : 당신이
너무 감사를 :) – Axelle