Moving Smartphone Camera around three.js Object

I have a simple rectangle which I have placed on my camera preview. I want to simulate an AR effect. When my camera moves, I don’t want the rectangle to move with it, but to stay fixed in position. I know that I have to access the gyroscope of my smartphone, but I don’t know how this works and how I have to connect these coordinates to the 3D camera. I program with Angular.

const scene = new THREE.Scene();
	const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
	const renderer = new THREE.WebGLRenderer({ alpha: true } );
	renderer.setSize( window.innerWidth, window.innerHeight );
	document.body.appendChild( renderer.domElement );
	const geometry = new THREE.BoxGeometry( 1, 1, 1 );
	const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
	const cube = new THREE.Mesh( geometry, material );
	scene.add( cube );
	camera.position.z = 5;
	const animate = () => {
			cube.rotation.x += 0.01;
			cube.rotation.y += 0.01;
			renderer.render( scene, camera );
};
animate();

I know that my animation is messed up, but this is not imporant. It is important for me to get the rotation trough moving the camera.

/cc