I am writing a custom portrait camera and I am having some issues with images orientation. In details, I need always the camera to be in portrait orientation and it happens using the manifest configuration:
android:screenOrientation="portrait"
and I set in application:
customCamera.setDisplayOrientation(90);
which works, because when I rotate the device (90,180,270 degrees) I can see (from camera preview) the right image.
I don't care when the device orientation is locked (disabled), but when it's enabled, it seems that I don't get any orientation change. I always get 0 degrees using the code:
getWindowManager().getDefaultDisplay().getRotation();
Technically, I need to write to the taken picture (using exif data) 0,1,3,6 or 8 value. So, the steps are: 1) set the right orientation on custom portrait camera - DONE! 2) Preview the right picture - DONE! 3) If the device orientation in enabled, get the current rotation (0.90,180,270 degrees) 4) Write the taken picture with the right orientation exif tag.
I am using Samsung Galaxy I for the development.
The question is: How can i get the device orientation when the application shows always a custom portrait camera, which should never be rotated, but the device orientation is enabled?
Thank you, Nikolaos