Permalink
Browse files

gps implementation on server

  • Loading branch information...
1 parent 93bd887 commit 2f0b07379221fdf7d91f8073e4478ec782985a08 src committed Jul 9, 2011
Showing with 51 additions and 0 deletions.
  1. +51 −0 server/gps.pde
View
@@ -0,0 +1,51 @@
+// Imports
+import android.content.Context;
+import android.location.Location;
+import android.location.LocationManager;
+import android.location.LocationListener;
+import android.location.GpsStatus.Listener;
+import android.location.GpsStatus.NmeaListener; // not needed yet, but going for nmea data next!
+import android.os.Bundle;
+
+LocationManager locationManager;
+MyLocationListener locationListener;
+
+// Variables to hold the current GPS data
+float currentLatitude = 0;
+float currentLongitude = 0;
+float currentAccuracy = 0;
+String currentProvider = "";
+
+//-----------------------------------------------------------------------------------------
+
+
+
+//-----------------------------------------------------------------------------------------
+
+
+
+//-----------------------------------------------------------------------------------------
+
+// Define a listener that responds to location updates
+class MyLocationListener implements LocationListener {
+ void onLocationChanged(Location location) {
+ // Called when a new location is found by the network location provider.
+ currentLatitude = (float)location.getLatitude();
+ currentLongitude = (float)location.getLongitude();
+ currentAccuracy = (float)location.getAccuracy();
+ currentProvider = location.getProvider();
+ }
+ void onProviderDisabled (String provider) {
+ currentProvider = "";
+ }
+
+ void onProviderEnabled (String provider) {
+ currentProvider = provider;
+ }
+
+ void onStatusChanged (String provider, int status, Bundle extras) {
+ // Nothing yet...
+ }
+
+}
+

0 comments on commit 2f0b073

Please sign in to comment.