virtual cube

I have a “cube” showing on my android device. I am trying to figure out how code it so that as you rotate the device in space, it is rotating “virtually” around my cube.

I’m guessing it would use a combo of compass, and accelerometer… but I’m having trouble figuring out how to go about this one.

Any ideas?

Thanks,

Richard