I want to get the device\'s deviation from the magnetic North in degrees, and use that value in some code I\'m writing.
I don\'t want to use the device\'s location
You need to fuse sensors to mimic the apple applications. They use the gyro accelerometer and magnetometer, and advanced mathmatics you may or may not have learned to produce such clean results. Good luck. You probably won't be able mimic them.