×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    20

    Smile LocationListener Interface OR loop with Thread.sleep for updating device location?

    Hi,
    I have a java me s60 application that updates the device location at regular intervals to a MySQL webserver. Currently I create an instance of the following class in a separate thread which continually loops, updates the webserver, then sleeps for 30 seconds...
    my question is , should i be using the LocationListener interface instead? The reason I ask is that when I google solutions for this issue everything seems to point to the LocationListener interface and i wonder if i'm missing something fundamental here?
    One question I have about LocationListener is can it be used trigger an update only when the Location is changed, and therefore this could cut down on the amount of updates to the server if the device was static for a period of time...
    any comments, advice appreciated...thanks

    public class LBSthreadableV8 implements Runnable {
    public void run() {
    LBSv8 lbs = new LBSv8();
    int count;
    count =1;
    while (count == 1) {
    TCV8.lat = lbs.getLat();
    TCV8.lon = lbs.getLon();

    String queryString = "";
    queryString = "/v3/DoD.php?TDLN=" + TCV8.TDLN+"&lat=" + TCV8.lat + "&lng=" +TCV8.lon+"&status=" +TCV8.status+"";
    NetworkV8 dod = new NetworkV8 ();
    dod.sendHttpUrl(queryString);
    interval();

    }

    }

  2. #2
    Registered User
    Join Date
    Feb 2010
    Posts
    20

    Re: LocationListener Interface OR loop with Thread.sleep for updating device locati

    Hi,
    just field tested the code above and there is a flaw...the database is being updated every 30 seconds successfully but the coordinate variables, TCV8.lat and TCV8.lon are not, will need to revisit my understanding of the Location API

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    20

    Re: LocationListener Interface OR loop with Thread.sleep for updating device locati

    ok...as far as i can make out what the application is doing currently is;
    1/creating an instance of LBSv8 (this class uses the LocationProvider/Location and Coordinates classes to get the lat and lng )
    2/ then sending the same lat and lng values to the webserver every 30 seconds.

    I think i will need to implement the locationListener interface with the LBSv8 class to update the ( LBSv8 class instance) lbs lat and lng variables...

    sorry, to be using the forum as a testing area but as i started the thread i think i should show how i bring it to a conclusion...

Similar Threads

  1. Thread.sleep in while loop
    By oaieuy in forum Mobile Java General
    Replies: 2
    Last Post: 2010-02-24, 16:22
  2. Thread.Sleep
    By ResHAcK in forum Mobile Java General
    Replies: 2
    Last Post: 2008-09-25, 12:28
  3. .location.locationListener in S40
    By yodarks in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2007-12-28, 17:12
  4. exiting a loop / loop and thread.
    By adamzieba in forum Mobile Java General
    Replies: 1
    Last Post: 2007-08-04, 15:15
  5. thread sleep
    By nodevelop in forum Mobile Java General
    Replies: 3
    Last Post: 2003-09-14, 19:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×