Commit a8769521 authored by Tarang Patel's avatar Tarang Patel

Update LocationUpdateService.java

parent 2d69f9e5
...@@ -179,8 +179,8 @@ public class LocationUpdateService extends Service implements LocationListener { ...@@ -179,8 +179,8 @@ public class LocationUpdateService extends Service implements LocationListener {
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
Notification.Builder builder = new Notification.Builder(this); Notification.Builder builder = new Notification.Builder(this);
builder.setContentTitle("Background tracking"); builder.setContentTitle("Eato Driver App");
builder.setContentText("ENABLED"); builder.setContentText("Ready");
builder.setSmallIcon(android.R.drawable.ic_menu_mylocation); builder.setSmallIcon(android.R.drawable.ic_menu_mylocation);
builder.setContentIntent(pendingIntent); builder.setContentIntent(pendingIntent);
Notification notification; Notification notification;
...@@ -221,7 +221,9 @@ public class LocationUpdateService extends Service implements LocationListener { ...@@ -221,7 +221,9 @@ public class LocationUpdateService extends Service implements LocationListener {
public boolean stopService(Intent intent) { public boolean stopService(Intent intent) {
Log.i(TAG, "- Received stop: " + intent); Log.i(TAG, "- Received stop: " + intent);
cleanUp(); cleanUp();
Toast.makeText(this, "Background location tracking stopped", Toast.LENGTH_SHORT).show(); if (isDebugging) {
Toast.makeText(this, "Background location tracking stopped", Toast.LENGTH_SHORT).show();
}
return super.stopService(intent); return super.stopService(intent);
} }
...@@ -478,9 +480,14 @@ public class LocationUpdateService extends Service implements LocationListener { ...@@ -478,9 +480,14 @@ public class LocationUpdateService extends Service implements LocationListener {
if (isMoving) { if (isMoving) {
return; return;
} }
startTone("beep"); if (isDebugging) {
startTone("beep");
}
float distance = location.distanceTo(stationaryLocation) - stationaryLocation.getAccuracy() - location.getAccuracy(); float distance = location.distanceTo(stationaryLocation) - stationaryLocation.getAccuracy() - location.getAccuracy();
Toast.makeText(this, "Stationary exit in " + (stationaryRadius-distance) + "m", Toast.LENGTH_LONG).show();
if (isDebugging) {
Toast.makeText(this, "Stationary exit in " + (stationaryRadius-distance) + "m", Toast.LENGTH_LONG).show();
}
// TODO http://www.cse.buffalo.edu/~demirbas/publications/proximity.pdf // TODO http://www.cse.buffalo.edu/~demirbas/publications/proximity.pdf
// determine if we're almost out of stationary-distance and increase monitoring-rate. // determine if we're almost out of stationary-distance and increase monitoring-rate.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment