Search Results

Search found 1 results on 1 pages for 'user568553'.

Page 1/1 | 1 

  • [Android] GPS can't run inside TimerTask

    - by user568553
    Hi, I am trying to write an android app that acquires a GPS signal at a fix time interval, for example every 1 minute. Since the requestLocationUpdate function does not exactly implement that, I tried to use task to accomplished it. public class getGPS extends TimerTask{ public void run(){ System.out.println("Running a GPS task"); locHandler = new locationUpdateHandler(); myManager.requestLocationUpdates(provider, 60000, 0, locHandler); } } public void LoadCoords(){ Timer timer = new Timer(); timer.scheduleAtFixedRate(new getGPS(), 0, 60000); } However, from what I've seen, requestLocationUpdates would run fine if I put it inside LoadCoords(), but would not run if I put it inside the TimerTask (ie no green icon on the task bar to show that GPS is looking for a fix). Can anyone please suggest an alternative approach or pseudo-code, or correct my mistake if there is one ? Thank you in advance.

    Read the article

1