Android Google 地图是否仍需要 READ_GSERVICES 权限?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24618806/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:30:34  来源:igfitidea点击:

Is READ_GSERVICES permission still required for Google Maps?

androidgoogle-mapsgoogle-play-services

提问by user2896182

To add Google Maps to your android application, you need to include a few permissions:

要将 Google 地图添加到您的 android 应用程序,您需要包含一些权限:

<!-- Required -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- Optional -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

However, by checking Google Maps Android API v2documentation again, I noticed that

但是,通过再次检查Google Maps Android API v2文档,我注意到

com.google.android.providers.gsf.permission.READ_GSERVICES

is no longer required. I tested it by removing it from AndroidManifest.xmland the map is loading fine without any problems.

不再需要。我通过从中删除它进行了测试,AndroidManifest.xml并且地图加载正常,没有任何问题。

So, my question is.. what is/was the purpose of READ_GSERVICESpermission?

所以,我的问题是……READ_GSERVICES许可的目的是什么?

Note: Even though it is removed from Google Maps Android API v2 documentation, it can be found on Google Maps API for Businessdocumentation.

注意:尽管它已从 Google Maps Android API v2 文档中删除,但仍可在Google Maps API for Business文档中找到。

回答by Marian Pa?dzioch

All permissions you need for Google Maps Android APIare in the docs:

您需要的所有权限Google Maps Android API都在文档中

You must also request the android.permission.WRITE_EXTERNAL_STORAGE permission.

Note: If you're targeting the Android M SDK (23) and the latest version of the Google Play services SDK (8.1), you no longer need the WRITE_EXTERNAL_STORAGE.

From the next release of the Google Play services SDK, the requirement for the WRITE_EXTERNAL_STORAGE permission will be completely dropped from the Google Maps Android API.

您还必须请求 android.permission.WRITE_EXTERNAL_STORAGE 权限。

注意:如果您的目标是 Android M SDK (23) 和最新版本的 Google Play services SDK (8.1),则不再需要 WRITE_EXTERNAL_STORAGE。

从 Google Play 服务 SDK 的下一个版本开始,Google Maps Android API 将完全取消对 WRITE_EXTERNAL_STORAGE 权限的要求。

So the answer is NO, you don't need it if you use current latest GPS, i.e. 8.1.0.

所以答案是否定的,如果您使用当前最新的 GPS,即 8.1.0,则不需要它。

回答by Hussein Alrubaye

NO, This persimmons is no longer required in google MAP API V2

不,google MAP API V2 不再需要这个柿子

    <permission
                 android:name="phonelocation.example.asuss550c.phonelocation.permission.MAPS_RECEIVE"
                 android:protectionLevel="signature" />  
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

You only need to add

你只需要添加

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

Also this MetaData in your Application Tag

还有这个 MetaData 在你的应用程序标签中

   <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />