Move/Rotate Camera using device's gyroscope/accellerometer

How can I move AND rotate the camera using the movement and rotation of the device. I’m thinking of a virtual reality device, only without a headset. I’ve googled extensively and cannot find anything.
Could anybody help me?

Thanks in advance - may be here are some answers? i needed fixed camera location with ability to view at any direction with mobile device, that script helped - don`t know if it can be combined with camera movement.