android开发 怎么检测手机是否有GPS
public boolean hasGPSDevice(Context context) { final LocationManager mgr = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); if ( mgr == null ) return false; final List<String> providers = mgr.getAllProviders(); if ( providers == null ) return false; return providers.contains(LocationManager.GPS_PROVIDER); }
浙公网安备 33010602011771号