Search code examples
androidpermissionscamera

Camera working without camera permission?


In one of our applications we use the camera intent to take pictures. This works on real devices - without the camera permission.

Is this correct or should I add it to this apps Manifest?

ContentValues contentValues = new ContentValues();
contentValues.put(MediaStore.Images.Media.DESCRIPTION, "Image capture");
contentValues.put(MediaStore.Images.Media.TITLE, "new image");

Uri uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);

startActivityForResult(intent, 1);

TIA


Solution

  • See this: http://mobile.tutsplus.com/tutorials/android/android-sdk-quick-tip-launching-the-camera/

    There are two things noted there. First: A Note on Permissions: Although your application is leveraging the Camera, it is not required to have the android.permission.CAMERA permission since it is not directly accessing the camera. Instead, it’s just launching the Camera application via Intent.

    I don't see this clarified anywhere at developer.android.com, though, so this could be wrong and something else is happening.

    It seems you only need the permission to access the camera primitives directly, and not via the Intent.

    Note, that the same URL above also points out that you should declare the feature to prevent users without cameras from seeing your app in the market.