Skip to content

Commit

Permalink
Fix stop logic
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-gc committed Jan 18, 2014
1 parent 116e37a commit e348ef9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion android/GeolocPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public void onLocationChanged(Location loc) {
}

// If it is time to stop requests,
if (System.currentTimeMillis() - _last_request < 30 * 1000) { // 30 seconds
if (!_gps_wanted ||
System.currentTimeMillis() - _last_request > 30 * 1000) // 30 sec
{
logger.log("{geoloc} Ending requests since the user has not requested any position data for a while");
stopRequests();
_gps_wanted = false;
Expand Down

0 comments on commit e348ef9

Please sign in to comment.