KetaiLocation: does onLocationEvent fire periodically or only once?

edited January 2017 in Android Mode

hello,

I'm fiddling around with KetaiLocation resp. the example that can be found at http://ketai.org/examples/geolocation/. In that example the onLocationEvent is used. I would have expected that event to fire every 10 seconds or if I moved more than one meter ("Updates if location changes by 1 meter, or every 10 seconds"). However, the println statement in onLocationEvent only prints once and never again. Is that the expected behavior or do have to call e.g. getLocation() explicitly in draw() to get periodic updates? Does anyone know?

Thanks, Stefan

Answers

  • Nop, you don't need to call getLocation() in draw. Just follow the exampke privided in ketai.org but you should also have a look at the ketai source code. There are a couple of functions to change the update rate. This will redirect you to the android API reference for more information. You can try googling android LocationManager and it should be one of the first results of the search.

    Kf

  • @5tefan===

    i dont know for ketai but with android native (that ketai tries to wrap) you create once an object from location manager and service. Then you add to it a request for updating which takes 2 parameters, time or meters. Finally you have a method onLocationChanged which is fired when updating happens: here you can add what you want (in your case "println..."); all this stuff can be done quite automatically if you make your app implementing LocationListener.

  • Answer ✓

    Just to answer my own question: Things are indeed working as advertised - I didn't consider the bad GPS signal reception in my courtyard. Once I took a walk around the block I saw the values being updated correctly.

    Thanks, Stefan

Sign In or Register to comment.