public boolean isCameraAvailableOnDevice(Activity activity) {
    return activity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)
        || activity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
  }
Check if the device has any front or rear camera for the barcode scanner.
java/com/google/android/apps/authenticator/barcode/BarcodeConditionChecker.java