Hi Aidan, I think it would help most to think about what you are asking of the hardware. The Location class is primarily concerned with the GPS hardware in the android. Now, at the root of it, GPS provides location data ONLY. Things like velocity, bearing, acceleration can be calculated from a GPS position vector and time. Velocity = MAG(pos'/ time'); Bearing = ANGLE(pos'/time'); Accel = MAGNITUDE(pos''/time''), etc. Now, from trig, you know that you can only calculate the angle of a non-zero magnitude vector. Therefore, if the GPS only knows your position and measures time and you are not moving, then it is impossible for GPS to know which direction you are facing, which is why you are having your problem there.
What you need to do in this case, is switch sensors and ask the magnetometer (compass) in the device which direction you are facing with respect to true north. To this end, I suggest you explore http://developer.android.com/reference/android/hardware/GeomagneticField.html On Jun 4, 7:30 am, Aidan C <[email protected]> wrote: > Hi Guys, > > I'm developing an app and I'm having problems getting it to update > getBearing when I'm not moving. getBearing(); always returns a 0.0 for me. I > have no idea why... I have Speed set to 1. I'm doing this so that > the bearing will change while the device is stationary, but when I manually > set the speed it will return 0.0. If I don't set the speed it works(by work > I mean updates about every second) but only when moving (e.g in a car). I'm > wondering is there a way to fix this? if so how? if not is there another way > to get my bearing to update while stationary every second? > > I'd appreciate any help! > > Regards, > > Aidan. -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en

