Our camera takepicture takes around 10-15 seconds (due to custom camera hardware). What I need is during this process of 10-15 seconds, I would not want the user to change the screen orientation.
I have placed the takepicture call in doInBackground of Async task.
In the onPreExecute() method I have placed
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
And in onPostExecute I placed
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
This solution doesn't work for me and causes the camera and device to be crashed and I had to reboot the device.
Did you try blocking the orientation from the AndroidManifest ? by adding the below line in your camera activity
<activity android:label="@string/activity_name" android:screenOrientation="portrait" />
or
<activity android:label="@string/activity_name" android:screenOrientation="landscape" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With