From 4e845dd78e4a3a1d24d5edafbdd51ede18e4a358 Mon Sep 17 00:00:00 2001 From: sjtufs Date: Fri, 23 Aug 2013 11:21:59 +0800 Subject: add tracker --- .../src/com/example/gpstracking/Tracker.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/Tracker.java (limited to 'client/gps-demo') diff --git a/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/Tracker.java b/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/Tracker.java new file mode 100644 index 0000000..2e08a91 --- /dev/null +++ b/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/Tracker.java @@ -0,0 +1,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); + } + } +} -- cgit v1.2.3-70-g09d2