summaryrefslogtreecommitdiff
path: root/client/activity-demo/Piztor/src/com/example/piztor/Tracker.java
diff options
context:
space:
mode:
Diffstat (limited to 'client/activity-demo/Piztor/src/com/example/piztor/Tracker.java')
-rw-r--r--client/activity-demo/Piztor/src/com/example/piztor/Tracker.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/client/activity-demo/Piztor/src/com/example/piztor/Tracker.java b/client/activity-demo/Piztor/src/com/example/piztor/Tracker.java
new file mode 100644
index 0000000..0222325
--- /dev/null
+++ b/client/activity-demo/Piztor/src/com/example/piztor/Tracker.java
@@ -0,0 +1,41 @@
+package com.example.piztor;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import android.content.Context;
+
+public class Tracker implements Runnable {
+
+ private static final long TIME_DELTA = 1000 * 10; // 10 seconds
+ public Timer timer;
+ private final Context mContext;
+ Controller controller;
+
+ public Tracker(Controller newController, Context context) {
+ timer = new Timer();
+ mContext = context;
+ controller = newController;
+ }
+
+ public void run() {
+ GPSTask t = new GPSTask();
+ t.run();
+ //timer.s
+// timer.schedule(new GPSTask(), 0, TIME_DELTA);
+ }
+
+ class GPSTask extends TimerTask {
+ @Override
+ public void run() {
+ GPSTracker tracker;
+ tracker = new GPSTracker(mContext);
+ System.out.println("can get location?");
+ if(tracker.canGetLocation()) {
+ double latitude = tracker.getLatitude();
+ double longitude = tracker.getLongitude();
+ System.out.println("yes!");
+ controller.recieveLocation(latitude, longitude);
+ }
+ }
+ }
+}