AI-generated Key Takeaways
-
Granularity
defines the level of location detail, impacting user privacy and app functionality. -
Location granularity can be set to
COARSE
,FINE
, orPERMISSION_LEVEL
, influencing the accuracy of location data provided. -
COARSE
granularity obfuscates the user's precise location, suitable for apps prioritizing privacy over accuracy. -
FINE
granularity provides precise location data, requiring theACCESS_FINE_LOCATION
permission and potentially impacting user privacy. -
PERMISSION_LEVEL
granularity dynamically adjusts location detail based on granted permissions, balancing accuracy and privacy.
Location granularity levels to be used with APIs within FusedLocationProviderClient
.
Coarse locations obfuscate the user's true position while still providing a less accurate view of the user's location. For applications that do not require the user's exact fine location (such as a weather app for example), use of coarse location is encouraged to protect the user's privacy. In addition, from Android 12 onwards, the user may force any app to use coarse location regardless of the application's preferences, so apps should always be prepared to work correctly with only access to coarse location.
Constant Summary
int | GRANULARITY_COARSE | The desired location granularity is always coarse, regardless of the client permission level. |
int | GRANULARITY_FINE | The desired location granularity is always fine, regardless of the client permission level. |
int | GRANULARITY_PERMISSION_LEVEL | The desired location granularity should correspond to the client permission level. |
Inherited Method Summary
Constants
public static final int GRANULARITY_COARSE
The desired location granularity is always coarse, regardless of the client
permission level. The client will be delivered coarse locations while it has the
Manifest.permission.ACCESS_FINE_LOCATION
or
Manifest.permission.ACCESS_COARSE_LOCATION
permission, and no location if it
lacks either.
public static final int GRANULARITY_FINE
The desired location granularity is always fine, regardless of the client permission
level. The client will be delivered fine locations while it has the
Manifest.permission.ACCESS_FINE_LOCATION
, and no location if it lacks that
permission.
public static final int GRANULARITY_PERMISSION_LEVEL
The desired location granularity should correspond to the client permission level.
The client will be delivered fine locations while it has the
Manifest.permission.ACCESS_FINE_LOCATION
permission, coarse locations while
it has only the
Manifest.permission.ACCESS_COARSE_LOCATION
permission, and no location if it
lacks either.