怎么解决这个问题啊
需要
add permission check
一个办法是将划红线代码放入 try/catch块。
try { Location location = locationManager.getLastKnownLocation(provider); } catch (SecurityException e) { e.printStackTrace(); // lets the user know there is a problem with the gps }
http://blog.csdn.net/weilang1828/article/details/53933549