If you do not distribute your application through the Market, and if you do not need the following recommendations, you only need the <uses-permission> tags for any permissions that the application uses. However, to allow the correct devices to access the application through the Market, you will need the <uses-permission> and <uses-feature> tags.
<uses-permission> is a request to grant your application the authority to take certain actions. In preparation for installing the application, the user can view the requested permissions and decide whether to proceed with the installation. If the application, for example, tries to make a phone call without declaring the permission "android.permission.CALL_PHONE", the attempt will fail. See here for a list of permissions of the underlying platform.
<uses-permission> also used by the market for implicit performance requirements. If your application uses a resolution that requires telephony hardware, the market suggests that telephony hardware is required and the application will not be available for a device that does not have telephony hardware.
<uses-feature> can be used to inform the Market that a specific function is required or that this function is desirable but not required. The tag will override any functions that are implied by <uses-permission> . If, for example, you specify <uses-feature android:name="android.hardware.telephony" android:required="false" /> , then telephony is not required, regardless of what permissions are requested.
To see how <uses-permission> and <uses-feature> interact to create market filters, see here .
To check if a function is available at run time, it looks like you can use PackageManager.hasSystemFeature () :
Context context; // Some object, such as Activity, that extends Context // ... boolean hasTelephony = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY); if (hasTelephony) { // ... } else { // ... }
source share