Working on an Android application and aiming to support a variety of different hardware is an interesting challenge, not least of which being that the Android emulator lies to you about its capabilities.
I created a new AVD (android virtual device) and specifically set the parameter (which the documentation says defaults to “no” anyhow) so that there would be no camera:
Later on, just to check what my code was doing I added a log statement after I queried what the package manager thought would be the capability:
boolean hasCamera = packageManager.hasSystemFeature( PackageManager.FEATURE_CAMERA); Log.e("DeviceSettings", "Package manager said about camera: "+hasCamera);
And the output?
The emulator lies! How am I meant to do my job? *sigh*