问题
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?
回答1:
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>
来源:https://stackoverflow.com/questions/29477490/android-quick-settings-notifications