According to the EFF, your if Android device is less than three years old, it may share your location with everyone even not connected to a Wi-Fi network.
If you connect your smartphone to a Wi-Fi network, the name of the network is stored in your device’s settings and the devices would send out messages with the names of these networks to speed up the connection process. Hackers could intercept these messages, and could get an idea about the users location.
Electronic Frontier Foundation (EFF) stated in a blog post that a user's location history could be determined from Android's behavior.
"This location history comes in the form of the names of wireless networks your phone has previously connected to," the EFF said. "These frequently identify places you've been, including homes ('Tom's Wi-Fi'), workplaces ('Company XYZ office net'), churches and political offices ('County Party HQ'), small businesses ('Toulouse Lautrec's house of ill-repute'), and travel destinations ('Tehran Airport wifi')."
To protect your Android device to stop leaking your location history data, you can go to your device’s “Advanced Wi-Fi” settings and set the “Keep Wi-Fi on during sleep” option to “Never.” However, the this feature will increase your data and battery usage.
EFF also found that smartphones were not the only devices suffering from the issue, but it affects all OS X laptops as well as Windows 7 laptops.
"Desktop OSes will need to be fixed, but because our laptops are not usually awake and scanning for networks as we walk around, locational history extraction from them requires considerably more luck or targeting," the EFF said.
Google stated in response to the EFF’s discovery:
“We take the security of our users’ location data very seriously and we’re always happy to be made aware of potential issues ahead of time. Since changes to this behavior would potentially affect user connectivity to hidden access points, we are still investigating what changes are appropriate for a future release.”
Read more about the vulnerability here — EFF