Integrate Garmin compass software and save the selected azimuth value inside an application code?

Hello guys,

I try to do an application.

Inside this application project, I would like to take a cap.
Is it possible to call the compass Garmin software to record the azimut cap inside the application?
Or do I have to recreate the compass from the magnetic sensor data?

I am beginner.

Thank you for your help,