security in letting apps have those permissions • Internet • Network state • flashlight …. Two types of permissions Dangerous App wants data or resources that involve the user's private information, or could potentially affect the user's stored data or the operation of other apps
Already granted Permission Display Why We need Permission Disable Feature Check if permission was previously denied Request Permission Handle Permission Request SDK >= 23 No Yes Denied Granted Yes No Check if app has permission
Using shouldShowRequestPermissionRationale(), we check if permission was previously denied. • If permission wasn’t denied, request it using ActivityCompat.requestPermissions()
activity • Handle the permission request result : PackageManager.PERMISSION_GRANTED or PackageManager.PERMISSION_DENIED • Disable the feature if permission denied