I use requestLocationUpdates listener receives data.
how can I determine that works requestLocationUpdates? need a method that will bring back true – if requestLocationUpdates enabled or false if I turned it off (removeUpdates)
I use requestLocationUpdates listener receives data. how can I determine that works requestLocationUpdates? need
Share
There is no such method. For the
LocationListenerflavor ofrequestLocationUpdates(), it is pretty easy for you to track it yourself:Step #1: Add a data member to some class, of type
boolean, namedareLocationUpdatesEnabled, initially set tofalse.Step #2: When you call
requestLocationUpdates(), setareLocationUpdatesEnabledtotrue.Step #3: When you call
removeUpdates(), setareLocationUpdatesEnabledtofalse.Step #4 (optional): Implement
areLocationUpdatesEnabled()as a method to return the value ofareLocationUpdatesEnabled.