My application requires quite a lot permissions.
Lets consider following: Internet, Camera, Fine_location.
The Internet permission is the only one required. For example, I know that only 10% of my customers use Camera and only 2% of my customers use GPS. I also know, that 20% of my customers refused to use my application, after gps features introduction.
As I know, one option if to make separate versions of applications, which has different features.
However, is it possible to give a choice to the user, which permissions he wants to accept? The features, which requires refused permissions, will be disabled. If such features were called an explanation would pop up proposing to accept required permission or to continue without such feature.
You can check whether you application have been granted specific permission by using following snippet. ( below I have given example )
if (context
.checkCallingOrSelfPermission(permission.ACCESS_COARSE_LOCATION) ==
PackageManager.PERMISSION_GRANTED
||
context
.checkCallingOrSelfPermission(permission.ACCESS_FINE_LOCATION) ==
PackageManager.PERMISSION_GRANTED
) {
// we have been granted above permission.Lets do the task
}
Also for system features you can specify following in manifest.
<uses-feature android:name="android.hardware.telephony" android:required="false" />
PackageManager packageManager = this.getPackageManager();
if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY))
{
Log.d("TEST", "TELEPHONY IS AVAILABLE");
} else {
Log.d("TEST", "TELEPHONY IS NOT AVAILABLE");
}