Hi.
I was testing the new GPS functions today. All works like expected on my iPad, but i can't get a small test program to work on my phone.
The speed is fixed at 0, accuracy at 16, but more important the locationTimeUTC returns a date 3 days back. Oddly enough, the google maps app does work and I can even play Ingress on this phone. (My phone is a samsung galaxy S plus.)
This is the (very trivial) code I use:
PHP Code:
dbl latitude;
dbl longitude;
flt speed;
flt accuracy;
DateTime time;
void InitPre()
{
EE_INIT();
}
bool Init()
{
LocationRefresh(1, true);
return true;
}
void Shut()
{
}
bool Update()
{
if(Kb.bp(KB_ESC))return false;
latitude = LocationLatitude();
longitude = LocationLongitude();
speed = LocationSpeed();
accuracy = LocationAccuracy();
time = LocationTimeUTC();
return true;
}
void Draw()
{
D.clear(BLACK);
D.text(Vec2(0, 0.9), S + "lat: " + latitude);
D.text(Vec2(0, 0.7), S + "lon: " + longitude);
D.text(Vec2(0, 0.5), S + "spd: " + speed);
D.text(Vec2(0, 0.3), S + "acc: " + accuracy);
D.text(Vec2(0, 0.1), S + time.asText());
}
Any suggestions?
Regards,
yvan
I got out for another walk (at the very least coding gps is good exercise :-) and had a few new findings.
Android didn't update again. I restarted my phone and now all functions return 0. I know initializing gps can take a while, so I waited a few minutes. Still nothing. Disabled sensor aided tracking. Still nothing. Then I switched to Google maps and saw gps was working. I got back to my test program and: result! There was an update from a few seconds ago.
After that, no updates any more. I switched to google maps again and got another update when I switched back to my test program. So my guess is that the refresh function is not doing its job.
Another strange thing is that when I got the results from Google Maps, i also got values for speed and accuracy. Quite good even, speed was at 0.6 - 0.8, accuracy from 3 to 9. So now i start wondering about the values on the iPad. Speed is fixed at zero there, accuracy at 65. Ofcourse this might be because of different hardware. I guess the GPS chip on the iPad might be less accurate to begin with. (Never trust apple, right? :-)
To wrap it up:
- could it be that the LocationRefresh function needs more work on Android?
- is it possible that the LocationSpeed function on iPad always returns zero, and why?
Regards,
yvan