yayaa / LocationManager

Simplify getting user's location for Android
806 stars 187 forks source link

Fix GoogleApiClient is not connected error #66

Closed yayaa closed 7 years ago

yayaa commented 7 years ago

Somehow, GoogleApiClient is not connected when removeLocationUpdates called in onLocationChanged which would mean GoogleApiClient is actually connected so we were able to retrieve location.

Same behaviour could cause crash again on requestLocationUpdate so within this PR, it is also covered with isConnected check and if it is not, it will re-try to connect.

Apparently connection in GoogleApiClient is neither so stable nor reliable.

Issue: https://github.com/yayaa/LocationManager/issues/56


@BiswajitRout thanks for your effort. Please feel free to take a look at the PR.

codecov-io commented 7 years ago

Codecov Report

Merging #66 into master will increase coverage by 0.28%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   66.66%   66.94%   +0.28%     
==========================================
  Files          31       31              
  Lines        1059     1068       +9     
  Branches       89       90       +1     
==========================================
+ Hits          706      715       +9     
  Misses        294      294              
  Partials       59       59
Impacted Files Coverage Δ
...onprovider/GooglePlayServicesLocationProvider.java 89.05% <100%> (+0.76%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d2ca5ef...cc5481e. Read the comment docs.

BiswajitRout commented 7 years ago

Sorry to not submit the changes. No idea what was the problem with my computer or anything else, it didn't allow me to push the committed files. By the way you did it more precisely. Thank you