!= PackageManager.PERMISSION_GRANTED) { if (shouldShowRequestPermissionRationale( Manifest.permission.WRITE_EXTERNAL_STORAGE)) { tvAlert.setText("Hey Man, I need this permission or I ..."); //Explain decently! } String[] reqPerms = {Manifest.permission.WRITE_EXTERNAL_STORAGE}; requestPermissions(reqPerms, REQ_CODE_EXT_STORAGE); return; } }
operation that requires that permission, the operation will not necessarily cause an exception. Instead, it might return an empty data set, signal an error, or otherwise exhibit unexpected behavior. For example, if you query a calendar without permission, the method returns an empty data set.” http://developer.android.com/preview/features/runtime-permissions.html https://github.com/aselims/android-RuntimePermissions
◦ Pre-M device, M app “1 shot” ◦ M device, M app “RT” ◦ M device, pre-M app “1 shot but revoked” handle M APIs: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {}
- Google Play Services & 3rd party Libs permissions - Selectively compile the libs that you need. https://developers.google. com/android/guides/setup - Edit Libs from source. Use Intents! “No control over UX”