Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell if the iPhone is "face down" or "face up"?

I need to detect which direction the iPhone is facing so I can record from the non obstructed camera (Front or Back) when dropped.

This will be used in emergency situation and the phone is dropped, or placed in such a way that the active camera is recording nothing of value.

What API or technique can I use to determine this?

like image 615
makerofthings7 Avatar asked Jan 07 '23 10:01

makerofthings7


1 Answers

Use the Core Motion accelerometer. It reports the direction of gravity, which tells you which way the device is facing.

like image 128
matt Avatar answered Jan 16 '23 16:01

matt