LocationManager

LocationManager

Android 中一般有三种位置提供器可供选择:
GPS_PROVIDER(LocationManager.GPS_PROVIDER = gps)
NETWORK_PROVIDER (LocationManager.NETWORK_PROVIDER = network)
PASSIVE_PROVIDER(LocationManager.PASSIVE_PROVIDER = passive)

两种权限:
1. android.permission.ACCESS_FINE_LOCATION
2. android.permission.ACCESS_COARSE_LOCATION

下面分析两种权限下可用的位置提供器:
执行代码:

locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
List<String> providerList = locationManager.getProviders(true);

LINE 时:
什么都不开,list 含有 passive, network;
开数据,同上;
开wifi,同上;
开GPS,同上,gps;

COARSE 时:
什么都不开,list 含有 network;
开数据,同上;
开wifi,同上;
开GPS,同上;

你可能感兴趣的:(android,定位)