Skip to content

Commit

Permalink
Check activity recognition connected before disconnecting
Browse files Browse the repository at this point in the history
  • Loading branch information
mendhak committed Aug 16, 2015
1 parent 3052a24 commit 98b6487
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ public void onConnectionFailed(ConnectionResult arg0) {
private void StopActivityRecognitionUpdates(){
try{
tracer.debug("Stopping activity recognition updates");
ActivityRecognition.ActivityRecognitionApi.removeActivityUpdates(googleApiClient, activityRecognitionPendingIntent);
googleApiClient.disconnect();
if(googleApiClient != null && googleApiClient.isConnected()){
ActivityRecognition.ActivityRecognitionApi.removeActivityUpdates(googleApiClient, activityRecognitionPendingIntent);
googleApiClient.disconnect();
}
}
catch(Throwable t){
tracer.warn(SessionLogcatAppender.MARKER_INTERNAL, "Tried to stop activity recognition updates", t);
Expand Down

0 comments on commit 98b6487

Please sign in to comment.