Don't set location if user isn't logged in

master
Keith Irwin 2017-04-23 09:09:16 -04:00
parent 289743142c
commit 6f8841a7f8
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
1 changed files with 18 additions and 12 deletions

View File

@ -265,6 +265,8 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
@Override
public void onLocationChanged(Location location) {
// Make sure we're logged in...
if (mUserID!=null && mUserSK!=null) {
JSONObject mLocationView = new JSONObject();
try {
mLocationView.put("usr", mUserID);
@ -277,7 +279,11 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
Log.e(TAG, "Failed to put JSON data");
}
socket.emit("set", mLocationView);
Log.v(TAG, "Location updated: " + mLocationView.toString());
Log.v(TAG, "Location set: " + mLocationView.toString());
}
else {
Log.v(TAG, "Can't set location because user isn't logged in.");
}
}