Link to home
Start Free TrialLog in
Avatar of websss
websssFlag for Kenya

asked on

Xamarin - Location tracking: getting the heading/bearing/direction ?

Hi

I'm a noob on xamarin
I'm creating a little app which simply sends latitude, longitude, speed and direction/heading to a server over TCP every 30 secs

The heading/direction is causing me some confusion
I'm expecting to get a result between 0 and 360 (degrees) which is indicative of the direction you are travelling (think north east south west)

However, I'm a little confused what sensors I need to enable as there seems to be:
Accelerometer
Gyroscope
Magnetometer
Compass

firstly i'm trying to get android working on Xamarin, but I also want iOS and Windows phone

Can anyone help me in choosing which one is "the one" or if there are many which "order of preference" i should use based on the phones supported hardware

Also, Is there a cross platform option that I'll need to use on Xamarin for iOS Android and windows?
Avatar of Hamidreza Vakilian
Hamidreza Vakilian

Gyroscope is the sensor that provides navigational direction data. But the direction it provides is the instant direction which the device is positioned at the moment. The problem is, when somebody is travelling north, the device is not necessarily always positioned towards the north. So this strategy will fail to calculate the direction of the travel.

Solution: send device's geo location (long/lat) to you server in intervals. Then on your server interpolate the geo points and calculate the slope of the path which it declares the direction of the travel. This process can also take place on the device.
Avatar of websss

ASKER

Thanks Hamidreza

We have this working with loads of tracking devices (not phones) and its sending the heading fine

Based on what you said, the issue is if the phone isn't pointed forwards then it will report the wrong direction moving.

I guess this is more complicated that I thought
SOLUTION
Avatar of Hamidreza Vakilian
Hamidreza Vakilian

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial