version:2.8
fix:修复无网络连接时请求接口报错 update:优化网络请求
This commit is contained in:
@@ -23,6 +23,8 @@ public class AmapManager {
|
||||
private AmapManager(Context context) {
|
||||
this.mContext = context;
|
||||
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps");
|
||||
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+network");
|
||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 1);
|
||||
initAmap();
|
||||
}
|
||||
|
||||
@@ -47,6 +49,8 @@ public class AmapManager {
|
||||
mLocationClient = new LocationClient(mContext);
|
||||
}
|
||||
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps");
|
||||
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+network");
|
||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 1);
|
||||
mLocationClient.setLocOption(getDefaultLocationClientOption());
|
||||
mLocationClient.registerLocationListener(mListener);
|
||||
mLocationClient.stop();
|
||||
|
||||
Reference in New Issue
Block a user