Simulate gyroscope with accelerometer and compass

Hello guys, I am making an Ionic App with its own GPS. I need to simulate the gyroscope in order to reach devices with no gyroscope to rotate the user’s position mark if he turns to the left or right. I think this is possible to simulate by combining the accelerometer and compass.

Am I right? How could I achieve it? Ive been with this for a week.