Start and stop a location watch
This sample gives the user control over a continuous location watch. Start begins updates; Stop calls clearWatch().
What you will learn
- How to keep a watch ID in a variable
- How to stop updates at the right time
- How to communicate the current state
Not watching.
A continuous watch can use battery and reveal movement patterns. Stop it when the user leaves the feature, and do not start it automatically without a clear reason.