About Store Forum Documentation Contact



Post Reply 
gps on android (won't work on my phone)
Author Message
yvanvds Offline
Member

Post: #1
gps on android (won't work on my phone)
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(1true);
   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(00.9), "lat: " latitude);
   
D.text(Vec2(00.7), "lon: " longitude);
   
D.text(Vec2(00.5), "spd: " speed);
   
D.text(Vec2(00.3), "acc: " accuracy);
   
D.text(Vec2(00.1), 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
(This post was last modified: 06-16-2013 09:45 PM by yvanvds.)
06-16-2013 08:51 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: gps on android (won't work on my phone)
Hello Yvan,

As for the iPad issues:
Location speed should be supported in EE for iOS, however, do you know if your iPad model actually supports GPS? (which iPad is it? 1-2-3-4, is it Wi-Fi or 3G/4G version?)
Speed at 0 and accuracy of 65 is an indicator that location could be accessed via wi-fi hotspot and not GPS.

As for the Android "Samsung Galaxy S plus", I think I've found out what could be wrong, thanks for the info on your type of phone as it pointed me in the right direction.
I'll check this idea and get back to you once I have a working version.
06-23-2013 03:39 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #3
RE: gps on android (won't work on my phone)
I've just uploaded a newer version of the EE 2.0, could you please let me know if LocationRefresh now works on your Gingerbread phone?

In previous release, last known GPS location was accessible, however LocationRefresh did not make any effect. Now with newer EE release, 'LocationRefresh' should be able to force refreshing the GPS on Gingerbread as well.
06-23-2013 04:17 PM
Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #4
RE: gps on android (won't work on my phone)
Thanks for the support!

My iPad is a Mini and you're right: it doesn't have GPS. The 'location services' are wifi only. Stupid, because i bought it also for the GPS functions. Turns out they're only available on the version with Cellular. Ah, well.

As for the gingerbread phone: works great now. I get good updates and accuracy (3-6m). One odd bit though:

Code:
void sliderFunc(ptr)
{
   int i = (*slider)() * 10;
   text.set(S + i);
   LocationRefresh(i, true);
  
}

That code should change the GPS refresh frequency. But LocationTimeUTC(), which should return the latest location update, always returns the current time. Which would mean one GPS update a second. That's also very very fast for gps, i believe.

So there are two options:
1. My GPS is updating at maximum frequency whatever i do at LocationRefresh. That would drain the battery very fast.
2. GPS does update like asked for in the LocationRefresh function, but the time is wrong.

It's not a real priority to me, but i guess it's better to sort it out anyway. I'll go for another walk later tonight and study the numbers a bit closer. See if I can find more info.

Most important thing is that it works now.

Regards,

yvan
06-23-2013 05:33 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #5
RE: gps on android (won't work on my phone)
Hi,

I'm using this function 'requestLocationUpdates' for obtaining location on Android:
http://developer.android.com/reference/a...ingIntent)

It states:
Quote:Prior to Jellybean, the minTime parameter was only a hint, and some location provider implementations ignored it. From Jellybean and onwards it is mandatory for Android compatible devices to observe both the minTime and minDistance parameters.

Glad that it works now! smile
06-23-2013 06:01 PM
Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #6
RE: gps on android (won't work on my phone)
Ok.

I guess that explains why Ingress drains my battery in less than an hour :-)

Thanks again!
06-23-2013 06:27 PM
Find all posts by this user Quote this message in a reply
Post Reply