version:2.8

fix:修复无网络连接时请求接口报错
update:优化网络请求
This commit is contained in:
2023-01-10 18:09:07 +08:00
parent cc5951ad0f
commit 74a0f631e2
31 changed files with 597 additions and 822 deletions

View File

@@ -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();