I\'m trying to access ACCESS_FINE_LOCATION and if it cannot be found access ACCESS_COARSE_LOCATION. So I request for those 2 permission, but they give
You do not need ACCESS_COARSE_LOCATION permission when you define ACCESS_FINE_LOCATION permission.
From Android Documentation:
Requesting User Permissions
In order to receive location updates from
NETWORK_PROVIDERorGPS_PROVIDER, you must request user permission by declaring either theACCESS_COARSE_LOCATIONorACCESS_FINE_LOCATIONpermission, respectively, in your Android manifest file. For example:....... Without these permissions, your application will fail at runtime when requesting location updates.
Note: If you are using both
NETWORK_PROVIDERandGPS_PROVIDER, then you need to request only theACCESS_FINE_LOCATIONpermission, because it includes permission for both providers. (Permission forACCESS_COARSE_LOCATIONincludes permission only forNETWORK_PROVIDER.)
Please look at https://developer.android.com/guide/topics/location/strategies.html