在拍摄照片时收集指南针方向和相机倾斜



我正在尝试收集拍照时手机的指南针方向和倾斜度。当然,我不确定有什么简单的方法可以做到这一点。我目前的相机实现使用:

    Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        File file = new File(Environment.getExternalStorageDirectory(), "test.jpg");
        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
        outputFileUri = Uri.fromFile(file);

        startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);  

请记住,必须在拍摄照片时收集倾斜和方向在调用相机意图时,我似乎在exif数据或内置功能中找不到任何东西。

谢谢!

我能想到的唯一方法是使用takePicture并在ShutterCallback中捕获指南针、倾斜和任何其他信息。这样,用户一按下快门按钮,你就会询问这些信息,而不是快门和触发PictureCallback之间经过的任意时间。

最新更新