gladiopeace / android-scripting

Automatically exported from code.google.com/p/android-scripting
1 stars 0 forks source link

Frequency of GPS update. #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is it possible that you could implement a method to control the frequency
of updates and distance as mentioned here:

http://developer.android.com/reference/android/location/LocationManager.html#req
uestLocationUpdates%28java.lang.String,%20long,%20float,%20android.app.PendingIn
tent%29

So something like:

droid.changeLocationFrequency(40000, 10)

could be used to change the update seconds to 40 and 10 metres, I think
that's right anyway. As the newest build 0.10-2 seems to produce less
frequent results than 0.9.

I would imagine it's due to the change of 

private static final int MIN_LOCATION_UPDATE_DISTANCE = 30;
private static final int MIN_LOCATION_UPDATE_TIME = 10000;

to:

private static final int MIN_LOCATION_UPDATE_DISTANCE = 30;
private static final int MIN_LOCATION_UPDATE_TIME = 60000;

is affecting my results. Anyway thanks for building this stuff, I use it a
little too much.

Original issue reported on code.google.com by thomasknowles on 25 Jul 2009 at 4:53

GoogleCodeExporter commented 9 years ago
That should be easy enough. However, the docs suggest a minimum of 60000 for the
updates (which is why I changed it).

Original comment by damonkoh...@gmail.com on 26 Jul 2009 at 8:13

GoogleCodeExporter commented 9 years ago
Yeah, I read that too, but that change has stopped me from updating to 0.10-2 
as I
only get a fresh result every minute (which is too slow for me). It should be 
left by
default at 60000, 30, but an option to change would be fantastic and offer a 
huge
level of flexibility. Thanks for accepting

Original comment by thomasknowles on 26 Jul 2009 at 8:35

GoogleCodeExporter commented 9 years ago

Original comment by damonkoh...@gmail.com on 10 Sep 2009 at 1:23

GoogleCodeExporter commented 9 years ago
I would also like to be able to get updated locations more frequently.

The recommendations (according to the link posted earlier here) read:
"Background services should be careful about setting a sufficiently high 
minTime so
that the device doesn't consume too much power by keeping the GPS or wireless 
radios
on all the time. In particular, values under 60000ms are not recommended. "

I wouldn't consider andriod scripting to be a "background service".  

Also this is only a recommendation to save power.  There are plenty of other 
ways
using android scripting to consume lots of power.

Can you please reduce the length, or make it programmable?

Original comment by Michael....@gmail.com on 11 Oct 2009 at 6:29

GoogleCodeExporter commented 9 years ago
@Michael.Neuling It is already programmable. Have a look at the API here: 
http://code.google.com/p/android-
scripting/source/browse/android/AndroidScriptingEnvironment/src/com/google/ase/A
ndroid
Proxy.java#157

Original comment by damonkoh...@gmail.com on 11 Oct 2009 at 9:05

GoogleCodeExporter commented 9 years ago
would it be possible to show a working example in code?

Original comment by merlspi...@gmail.com on 11 Oct 2009 at 4:19

GoogleCodeExporter commented 9 years ago
Just do :
startLocating('fine', update_time, update_distance)

Original comment by jcabil...@gmail.com on 11 Oct 2009 at 4:24

GoogleCodeExporter commented 9 years ago
@damonkohler thanks.

Using startLocating('fine', 1000, 1) I only ever get network locations (unless I
explicitly turn off network locating in my system settings).  Is there someone 
to get
GPS locations without having to turn off network locating?

Original comment by Michael....@gmail.com on 12 Oct 2009 at 10:01

GoogleCodeExporter commented 9 years ago
@Michael.Neuling Android figures out how to get the best position 
automatically. There 
isn't currently a toggle for network locating in the ASE API. Otherwise, you 
could use 
that to force purely GPS updates. Make sure you don't have a typo when you 
specify 
'fine'. If you do, it will default to 'coarse'.

Original comment by damonkoh...@gmail.com on 20 Oct 2009 at 2:22

GoogleCodeExporter commented 9 years ago
@damonkohler If I have a fully charge battery, under what conditions would you 
expect
it to start using the GPS instead of the network?  If I was driving at around 
60kph
for 5 min, would it likely switch to GPS?

Also, can you explain why being about to "force purely GPS updates" is a bad 
thing? 
In fact, this is what the native Google Maps application seems to do.  As soon 
as I
start it, it forces the GPS on.  

PS. no typo, although if ASE provided some error checking, that might be nice 
:-)

Original comment by Michael....@gmail.com on 25 Oct 2009 at 8:58

GoogleCodeExporter commented 9 years ago
I can help with this a bit I think. The locating service will provide you with 
the
result that it can get the fastest, unless one of two things has happened. If 
you
have restricted the location information to either the GPS or the network, you 
will
get that result. This also applies if for some reason one or the other service 
is
unavailable, you will get the remaining service if it can provide a location. 
(not a
given.) The alternative is if you specify 'fine' or 'course' resolution, the 
location
service will give you a GPS location or Network location if that is available.

So if you are driving at 10 miles per hour on a winding road where there is no 
cell
phone network, and you have enabled both location systems, you will get a gps
location. For areas where a network location is available, it is almost always 
faster
to get that than a gps location, so you will usually get that. If you specify 
'fine'
it will make a best effort to get a gps location, which may not be possible. In 
that
case it will give you the best location it can, which will be the network 
location.

Does that help?

Original comment by rusty0...@gmail.com on 25 Oct 2009 at 9:28

GoogleCodeExporter commented 9 years ago
> If you specify 'fine' it will make a best effort to get a gps location, which 
may
not be possible.

This statement would suggest if I use 'fine' and stand out in the open (even 
with
cell towers in range) it should try to use GPS?  Correct?  I don't find this to 
be
the case.  

FYI I'm using an HTC Magic (1.5 firmware) and the ase_r13.apk release.

Original comment by Michael....@gmail.com on 25 Oct 2009 at 10:34

GoogleCodeExporter commented 9 years ago
The current implementation attempts to get the best provider, as rusty said. 
The best 
provider may not be GPS for some reason. It is possible to specifically get GPS 
results. Please feel free to file a feature request for this.

Original comment by damonkoh...@gmail.com on 31 Oct 2009 at 8:30