本机移动应用程序的基本地理定位权限

Basic geolocalisation permissions for native mobile applications

我做了一些调查,但找不到我要找的东西。

我正在寻找不同的权限以允许 google 地图本地化访问我的 android 应用程序,我找到了这个 ACCESS_FINE_LOCATIONACCESS_COARSE_LOCATION 但我没有了解如何让它发挥作用。

查看此官方网站 link,其中提供了有关这两种权限的说明: https://developer.android.com/guide/topics/location/strategies.html#Permission

引用:

In order to receive location updates from NETWORK_PROVIDER or GPS_PROVIDER, you must request the user's permission by declaring either the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission, respectively, in your Android manifest file. Without these permissions, your application will fail at runtime when requesting location updates.

If you are using both NETWORK_PROVIDER and GPS_PROVIDER, then you need to request only the ACCESS_FINE_LOCATION permission, because it includes permission for both providers. Permission for ACCESS_COARSE_LOCATION allows access only to NETWORK_PROVIDER.

这意味着,您只需要根据上述需要在 AndroidManifest.xml 中使用两者之一。

将以下内容添加到 manifest 文件中,您应该就可以了:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />