Use Google Maps API MapView without permission

2019-03-03 08:44发布

Does anyone know if it's possible to use the Google Maps API for Android's MapView without giving it location permission? I just want to render a map and place a marker on it. I am not asking for the user's location in any way.

I cannot use the MapFragment because I am housing this view inside another Fragment, and nested fragments aren't supported until Android 4.2.

2条回答
一夜七次
2楼-- · 2019-03-03 09:13

If your just want to show a map with a marker, I'd suggest using the Google Maps Static Maps API. Using this you can display an image of the map with markers and lot of other maps option. You can then open the actual Google Maps when the user clicks on the image. This would require the internet permission though.

<uses-permission android:name="android.permission.INTERNET" /> 
查看更多
贼婆χ
3楼-- · 2019-03-03 09:15

Per the specify Android permissions section:

The following location permissions are recommended, but you can omit them if your application doesn't access the user's current location, either programmatically or by enabling the My Location layer.

The only case where it should request the permission is if you are calling setMyLocationEnabled(true).

查看更多
登录 后发表回答