summaryrefslogtreecommitdiff
path: root/misc/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/Tracker.java
blob: 2e08a916de9ba93acc9e9eb477d53457fc4a199e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.example.gpstracking;

import java.util.Timer;
import java.util.TimerTask;

public class Tracker implements Runnable {

	private static final long TIME_DELTA = 1000 * 60 * 5;	

	Controller controller;

	public Tracker(Controller newController) {
		controller = newController;
	}

	public void run() {
		public Timer timer;
		TimerTask task = new GPSTask();	
		timer.schedule(new GPSTask(), 0, TIME_DELTA);
	}

	class GPSTask extends TimerTask {
		public void run() {
			GPSTracker tracker;
			tracker = new GPSTracker(Tracker.this);

			double latitude = tracker.getLatitude();
			double longitude = tracker.getLongitude();

			controller.recieveLocation(latitude, longitude);
		}
	}
}