Is READ_GSERVICES permission still required for Google Maps?

对着背影说爱祢 提交于 2019-12-19 12:23:22

问题


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

<!-- 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 v2 documentation again, I noticed that

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

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

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

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


回答1:


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

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.

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




回答2:


NO, This persimmons is no longer required in 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

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


来源:https://stackoverflow.com/questions/24618806/is-read-gservices-permission-still-required-for-google-maps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!