Broadcast receiver for GPS state?

后端 未结 1 1186
隐瞒了意图╮
隐瞒了意图╮ 2021-01-23 05:22

Is there a way to be notified when the GPS is switched on/off?

I noticed that when the device is switched off an then on again, getLastKnownLocation(provider) is null. S

相关标签:
1条回答
  • 2021-01-23 05:58

    Register a BroadcastReceiver to listen for the LocationManager's PROVIDERS_CHANGED_ACTION Intent. This will be broadcast when the GPS provider (and other providers) is enabled / disabled.

    0 讨论(0)
提交回复
热议问题