Google Maps v2 Error on use of setMyLocationEnabled

筅森魡賤 提交于 2019-12-04 15:28:53

getmap() is returning null. That means the map is not ready. Either because the fragment is not ready or your are running on a device without Google Play services available. See getMap for more info.

I was getting something simular due to the Google Play Services API being missing from the device. If you use:

GooglePlayServicesUtil.isGooglePlayServicesAvailable(Context)

It should return ConnectionResult.SUCCESS if available. if it returns

ConnectionResult.SERVICE_MISSING
ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
ConnectionResult.SERVICE_DISABLED

you can prompt the user to download it using

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