Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Location provider enabled/disabled #137

Merged
merged 8 commits into from
Nov 11, 2016
Merged

Location provider enabled/disabled #137

merged 8 commits into from
Nov 11, 2016

Conversation

sarahsnow1
Copy link
Contributor

Overview

This PR changes the underlying mechanism that Lost uses to notify of providers enabled/disabled from a LocationListener to a ContentObserver on the system location provider setting.

Proposed Changes

FusionEngine no longer does anything with its provider changed LocationListener methods and instead uses LocationProviderChangedHandler to receive notifications of providers enabled & disabled. The LocationProviderChangedHandler handles setting up a ContentObserver to listen to changes to Settings.System.LOCATION_PROVIDERS_ALLOWED.

Closes #123

@@ -1,6 +1,7 @@
package com.mapzen.android.lost.api;

import android.location.Location;
import android.os.Looper;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lost:checkstyle[ant:checkstyle] /home/ubuntu/lost/lost/src/main/java/com/mapzen/android/lost/api/LocationListener.java:4:8: Unused import - android.os.Looper.


private void checkLocationAvailability() {
LocationAvailability availability =
LocationServices.FusedLocationApi.getLocationAvailability(client);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While exercising a call to FusedLocationApi.getLocationAvailability(client) is good we should also verify that LocationCallback is properly invoked when location updates have been requested and provider status changes occur.

https://github.com/mapzen/lost/blob/master/lost/src/main/java/com/mapzen/android/lost/api/FusedLocationProviderApi.java#L100-L101

This is the use case that would more suitably replace LocationListener.onProviderEnabled(String provider) and LocationListener.onProviderDisabled(String provider) since the client app is relying on a push style notification rather than actively polling the provider status.

@@ -17,14 +18,28 @@
void onLocationChanged(Location location);

/**
* Called when a location provider is disabled.
* Called when a location provider is disabled. You will only receive updates for the priority
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ecgreb ecgreb merged commit 95790f6 into master Nov 11, 2016
@ecgreb ecgreb deleted the 123-on-provider-changed branch November 11, 2016 21:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants