Check if device has a camera?

This is what I’m using

import android.content.pm.PackageManager;

PackageManager pm = context.getPackageManager();

if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
}

All sorts of other fun things to test for are available too – the compass, is location available, is there a front facing camera:
http://developer.android.com/reference/android/content/pm/PackageManager.html

Leave a Comment