Sofi Software LLC
Sofi Software LLC

Reputation: 3939

Android Quick Settings notifications?

In gms.location.FusedLocationProviderApi, the way to check if location settings are enabled is to call checkLocationSettings. That's great for polling, but it's possible for the user to turn location on/off using the new Quick Settings menu (swipe down from top), which does not necessarily trigger onResume in the top activity (if location is turned on, there's a dialog, but if it's turned off, there isn't one).

What's the right way to get notified when a Quick Setting toggles Location?

Upvotes: 0

Views: 205

Answers (1)

Sofi Software LLC
Sofi Software LLC

Reputation: 3939

And the answer is... android.location.PROVIDERS_CHANGED is broadcast when a change is made to location in Quick Settings.

    <receiver
        android:name=".LocationProvidersChangedReceiver"
        >
        <intent-filter>
            <action android:name="android.location.PROVIDERS_CHANGED" />
        </intent-filter>
    </receiver>

Upvotes: 2

Related Questions