Skip to content Skip to sidebar Skip to footer

How To Make Sure An Android Device Application Supports Hardware Feature

I am developing an application which uses camera extensively. What I wish to do is that if a device or tablet does not have camera it my application should not get installed on it.

Solution 1:

Add this to your manifest:

<uses-featureandroid:name="android.hardware.camera"android:required="true" />

uses-feature tag

Solution 2:

You can use code to check device support feature :
PackageManager pm = getPackageManager();
if (!pm.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS)) {
    // This device does not have a compass, turn off the compass featuredisableCompassFeature();
}
preference link : http://developer.android.com/guide/practices/compatibility.html#Features

Post a Comment for "How To Make Sure An Android Device Application Supports Hardware Feature"