检测Android机器是否有GPS模块的代码
jopen
11年前
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); }