Prepare for release 0.5.0

master
Keith Irwin 2017-03-15 06:37:03 -04:00
parent 4dbbc818bb
commit 579337a08f
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
4 changed files with 45 additions and 45 deletions

View File

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -41,8 +41,8 @@ import java.net.URISyntaxException;
public class LocationService extends Service implements GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener, LocationListener {
public LocationService() {}
private String TAG = "LocationService";
final String SERVER_ADDRESS = "https://dev.tracman.org";
//private String TAG = "LocationService";
final String SERVER_ADDRESS = "https://tracman.org";
private Socket socket;
private String mUserID;
@ -100,7 +100,7 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
@Override
public void onReceive(Context context, Intent intent) {
connectLocationUpdates(300, LocationRequest.PRIORITY_NO_POWER);
Log.d(TAG, "Priority and interval lowered due to low power");
//Log.d(TAG, "Priority and interval lowered due to low power");
}
};
@ -121,24 +121,24 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
@Override
public void onCreate() {
super.onCreate();
Log.d(TAG, "onCreate called");
//Log.d(TAG, "onCreate called");
// Get preferences
sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
setupNotifications(true);
showNotification(getText(R.string.connecting), false);
Log.d(TAG, "Notification set up");
//Log.d(TAG, "Notification set up");
buildGoogleApiClient();
Log.d(TAG, "Google API Client built");
//Log.d(TAG, "Google API Client built");
mGoogleApiClient.connect();
Log.d(TAG, "Connected to Google API Client");
//Log.d(TAG, "Connected to Google API Client");
IntentFilter lowPowerFilter = new IntentFilter();
lowPowerFilter.addAction("android.intent.action.BATTERY_LOW");
registerReceiver(LowPowerReceiver, lowPowerFilter);
Log.d(TAG, "LowPowerReceiver activated");
//Log.d(TAG, "LowPowerReceiver activated");
mUserID = sharedPref.getString("loggedInUserId", null);
mUserSK = sharedPref.getString("loggedInUserSk", null);
@ -153,21 +153,21 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
showNotification(getText(R.string.connected), false);
// Log errors
socket.io().on(Manager.EVENT_TRANSPORT, new Emitter.Listener() {
@Override
public void call(Object... args) {
Transport transport = (Transport) args[0];
transport.on(Transport.EVENT_ERROR, new Emitter.Listener() {
@Override
public void call(Object... args) {
Exception e = (Exception) args[0];
Log.e(TAG, "Transport error " + e);
e.printStackTrace();
e.getCause().printStackTrace();
}
});
}
});
// socket.io().on(Manager.EVENT_TRANSPORT, new Emitter.Listener() {
// @Override
// public void call(Object... args) {
// Transport transport = (Transport) args[0];
// transport.on(Transport.EVENT_ERROR, new Emitter.Listener() {
// @Override
// public void call(Object... args) {
// Exception e = (Exception) args[0];
// Log.e(TAG, "Transport error " + e);
// e.printStackTrace();
// e.getCause().printStackTrace();
// }
// });
// }
// });
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
@Override
@ -183,7 +183,7 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
} catch (URISyntaxException e) {
showNotification(getText(R.string.server_connection_error), false);
Log.e(TAG, "Failed to connect to sockets server " + SERVER_ADDRESS, e);
//Log.e(TAG, "Failed to connect to sockets server " + SERVER_ADDRESS, e);
}
}
@ -214,11 +214,11 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
// Get permission
if (!checkLocationPermission(this)) {
Log.d(TAG, "Location permission denied");
//Log.d(TAG, "Location permission denied");
//TODO: Turn off location updates
} else {
Log.d(TAG, "Location permission granted");
//Log.d(TAG, "Location permission granted");
// Request location updates
if (mGoogleApiClient.isConnected()) {
@ -244,7 +244,7 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
@Override
public void onConnected(Bundle bundle) {
Log.d(TAG, "onConnected called");
//Log.d(TAG, "onConnected called");
mLocationRequest = LocationRequest.create();
connectLocationUpdates(getIntervalSetting(), getPrioritySetting());
@ -258,7 +258,7 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Log.e(TAG, "onConnectionFailed: " + connectionResult);
//Log.e(TAG, "onConnectionFailed: " + connectionResult);
showNotification(getText(R.string.google_connection_error), false);
buildGoogleApiClient();
}
@ -267,11 +267,11 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
@Override
public void call(final Object... args) {
if (args[0].toString().equals("true")) {
Log.d(TAG, "Activating realtime updates");
//Log.d(TAG, "Activating realtime updates");
connectLocationUpdates(getIntervalSetting(), getPrioritySetting());
showNotification(getString(R.string.realtime_updates), true);
} else {
Log.d(TAG, "Deactivating realtime updates");
//Log.d(TAG, "Deactivating realtime updates");
connectLocationUpdates(300, LocationRequest.PRIORITY_NO_POWER);
showNotification(getString(R.string.occasional_updates), false);
}
@ -290,36 +290,36 @@ public class LocationService extends Service implements GoogleApiClient.Connecti
mLocationView.put("dir", String.valueOf(location.getBearing()));
mLocationView.put("spd", String.valueOf(location.getSpeed()));
} catch (JSONException e) {
Log.e(TAG, "Failed to put JSON data");
//Log.e(TAG, "Failed to put JSON data");
}
socket.emit("set", mLocationView);
Log.v(TAG, "Location updated: " + mLocationView.toString());
//Log.v(TAG, "Location updated: " + mLocationView.toString());
}
@Override
public void onConnectionSuspended(int i) {
Log.d(TAG, "onConnectionSuspended called");
//Log.d(TAG, "onConnectionSuspended called");
showNotification(getText(R.string.google_connection_error), false);
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "onDestroy executed");
//Log.d(TAG, "onDestroy executed");
socket.disconnect();
socket.off("activate", onActivate);
Log.d(TAG, "Disconnected from sockets");
//Log.d(TAG, "Disconnected from sockets");
mGoogleApiClient.disconnect();
Log.d(TAG, "Google API disconnected");
//Log.d(TAG, "Google API disconnected");
unregisterReceiver(LowPowerReceiver);
Log.d(TAG, "LowPowerReceiver deactivated");
//Log.d(TAG, "LowPowerReceiver deactivated");
setupNotifications(false);
showNotification(getText(R.string.disconnected), false);
Log.d(TAG, "Notification changed");
//Log.d(TAG, "Notification changed");
}
}

View File

@ -51,11 +51,11 @@ public class LoginActivity extends AppCompatActivity implements
private static final int RC_SIGN_IN = 9001;
// Development
private final String SERVER_ADDRESS = "https://dev.tracman.org/";
private static final String GOOGLE_WEB_CLIENT_ID = "483494341936-hps4p2pcu3ctshjvqm3pqdbg0t0q281o.apps.googleusercontent.com";
//private final String SERVER_ADDRESS = "https://dev.tracman.org/";
//private static final String GOOGLE_WEB_CLIENT_ID = "483494341936-hps4p2pcu3ctshjvqm3pqdbg0t0q281o.apps.googleusercontent.com";
// Production
// private final String SERVER_ADDRESS = "https://tracman.org/";
// private static final String GOOGLE_WEB_CLIENT_ID = "483494341936-hrn0ms1tebgdtfs5f4i6ebmkt3qmo16o.apps.googleusercontent.com";
private final String SERVER_ADDRESS = "https://tracman.org/";
private static final String GOOGLE_WEB_CLIENT_ID = "483494341936-hrn0ms1tebgdtfs5f4i6ebmkt3qmo16o.apps.googleusercontent.com";
private GoogleApiClient mGoogleApiClient;
private ProgressDialog mProgressDialog;

View File

@ -34,7 +34,7 @@ import java.util.List;
* API Guide</a> for more information on developing a Settings UI.
*/
public class SettingsActivity extends AppCompatPreferenceActivity {
private static final String TAG = "SettingsActivity";
//private static final String TAG = "SettingsActivity";
private static final int MY_FINE_LOCATION_PERMISSION = 425;
/**
@ -145,7 +145,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
@Override
protected void onStop() {
Log.d(TAG, "onStop called");
//Log.d(TAG, "onStop called");
super.onStop();
// Restart service so settings can take effect