normal
defaultConfig { minSdkVersion 9 targetSdkVersion 23 } dependencies { compile 'com.android.support-v4:23.0.1 }
@Override public void onConnectionFailed(ConnectionResult result) { if (mResolvingError) { // Already attempting to resolve an error. return; } else if (result.hasResolution()) { try { mResolvingError = true; result.startResolutionForResult(this, REQUEST_RESOLVE_ERROR); } catch (SendIntentException e) { // There was an error with the resolution intent. Try again. mGoogleApiClient.connect(); } } else { // Show dialog using GooglePlayServicesUtil.getErrorDialog() showErrorDialog(result.getErrorCode()); mResolvingError = true; } }
private static final int REQUEST_CODE_LOCATION = 2; if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // Request missing location permission. ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE_LOCATION); } else { // Location permission has been granted, continue as usual. Location myLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); }
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { if (requestCode == REQUEST_CODE_LOCATION) { if(grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // success! Location myLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); } else { // Permission was denied or request was cancelled } }
private static final int REQUEST_CODE_LOCATION = 2; if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // Check Permissions Now if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) { // Display UI and wait for user interaction } else { ActivityCompat.requestPermissions( this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE_LOCATION); } } else { // permission has been granted, continue as usual Location myLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); }
adb shell pm list permissions -g -d
mFragment = (SearchFragment) getFragmentManager() .findFragmentById(R.id.search_fragment); if (!USE_INTERNAL_SPEECH_RECOGNIZER) { mSpeechRecognitionCallback = new SpeechRecognitionCallback() { @Override public void recognizeSpeech() { if (DEBUG) Log.v(TAG, "recognizeSpeech"); // ACTION_RECOGNIZE_SPEECH startActivityForResult(mFragment.getRecognizerIntent(), REQUEST_SPEECH); } }; mFragment.setSpeechRecognitionCallback(mSpeechRecognitionCallback); }
제거된 권한그룹 메서드 이름 결과 PHONE TelephonyManager#getLine1Number() null STORAGE MediaStore 에 콘텐츠를 요청하는 경우 Empty Cursor STORAGE 외부 디렉토리에 파일을 읽거나 쓰려고 하는 경우 throw FileNotFoundException CAMERA CameraManager#openCamera() throw CameraAccessException CONTACTS 주소록 정보 요청 시 Empty Cursor LOCATION LocationManager#getAllProviders() Empty Provider List SMS 텍스트 메세지 정보 요청 시 Empty Cursor SMS SMS_DELIVER 브로드캐스트 인텐트 수신 시도 시 수신 할 수 없음