2011-05-26 79 views

回答

0

要检查你的GPS的可用性,可以使用下面的代码

LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 

    if(!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { 
     //gps off. User turned the GPS off manually. 
    } 
+0

谢谢..这个工作.. – Sergio 2011-05-26 12:31:00

0
boolean gpSstate = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); 
    boolean networkState =locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); 
if(!gpsState && !networkState) {// no GPS Service }