Android Question Help with GPS bearing

davelew1s

Active Member
Licensed User
Longtime User
HI!
I wrote this app some time ago it's bits of code from the forum, it is only used by me and only on 1 phone so it's quite basic. It works ok apart from one thing.
If i am on a heading of 359 degrees then turn right to 1 degree the compass rotates backwards to 1 degree and not through North as i want, this happens both ways.
I have tried several ways to cure this but cannot find a solution, any ideas or help.
 

Attachments

  • GPS.zip
    15.4 KB · Views: 126

TILogistic

Expert
Licensed User
Longtime User
ok, you only use GPS.. Sorry

test:

Private LastLocation As Location

B4X:
Public Sub LocationChanged(Location1 As Location)

    If LastLocation.IsInitialized Then
        Location1.Bearing = LastLocation.BearingTo(Location1)
    Else
        LastLocation = Location1
    End If


.....

Bearing:

LastLocation.BearingTo(Location1)

This indicates where I turn the GPS

the turn is calculated with the previous and current positions.

Lat, Long previous and current
 
Last edited:
Upvote 0

emexes

Expert
Licensed User
any ideas or help.
If I understand this correctly: if you are on 359 degrees and turn right 2 degrees, to new bearing of 1 degree, then it animates 358 degrees left.

What happens if you are on 359 degrees and turn right 2 degrees, to new bearing of 361 degrees?
 
Upvote 0

davelew1s

Active Member
Licensed User
Longtime User
Thanks for the replies, my internet has been off for 2 days so i've not had time to study them yet, I will and report back.
 
Upvote 0
Top