delight-im / Android-SimpleLocation

Utility class for easy access to the device location on Android
Apache License 2.0
200 stars 75 forks source link

passiveMode, what does it mean ? #38

Open kmIndonesia opened 4 years ago

kmIndonesia commented 4 years ago

I have tried to read the readme and I have tried to search in the 'issues' section, but I can't find documentation about the difference between passiveMode == true and passiveMode == false

could you please help us to explain about this parameter ?

ocram commented 4 years ago

Thanks, good question!

The documentation seems to have little information on the passive mode, you’re right.

From the docs of the Android APIs that we use internally:

A special location [mode] for receiving locations without actually initiating a location fix. […] This […] can be used to passively receive location updates when other applications or services request them without actually requesting the locations yourself.

So your application does not actively cause the operating system to refresh its location information and do work (which costs battery, etc.), but instead just uses the location information that other apps have queried previously.

So if you only need some location, not necessarily the most recent one, and you don’t care about the accuracy that much, i.e. you don’t care if it’s from GPS or Wi-Fi, then passive mode may be for you.

Does that help?