feat(location): 重构定位流程并支持定位结束后还原系统设置
This commit is contained in:
@@ -59,7 +59,6 @@ import com.aoleyun.sn.utils.Utils;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.baidu.location.BDAbstractLocationListener;
|
||||
import com.baidu.location.BDLocation;
|
||||
import com.baidu.location.LocationClient;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
@@ -444,10 +443,8 @@ public class PushManager {
|
||||
Toaster.debugShow("收到管控:获取设备信息");
|
||||
getBatteryInfo(mContext);
|
||||
sendRefreshBroadcast(mContext);
|
||||
LocationClient locationClient = MapManager.getInstance().getLocationClient();
|
||||
locationClient.stop();
|
||||
locationClient.start();
|
||||
locationClient.registerLocationListener(new BDAbstractLocationListener() {
|
||||
//定位前记录并临时开启系统定位设置,定位结束自动还原
|
||||
MapManager.getInstance().startLocation(new BDAbstractLocationListener() {
|
||||
@Override
|
||||
public void onReceiveLocation(BDLocation location) {
|
||||
if (null != location) {
|
||||
@@ -479,7 +476,8 @@ public class PushManager {
|
||||
}
|
||||
Log.e(TAG, "MapAddress: " + mMMKV.decodeString("MapAddress", "-"));
|
||||
Log.e(TAG, "MapError: " + mMMKV.decodeString("MapError", "-"));
|
||||
locationClient.stop();
|
||||
//定位结束(成功或失败),停止定位并还原定位前的系统设置
|
||||
MapManager.getInstance().stopLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1240,10 +1238,13 @@ public class PushManager {
|
||||
}
|
||||
|
||||
String default_browser = jsonObject.get("default_browser").getAsString();
|
||||
Log.e(TAG, "setDefalutApp: default_browser = " + default_browser);
|
||||
Intent intent = new Intent("setDefaultBrowser");
|
||||
intent.putExtra("package", default_browser);
|
||||
if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
intent.setPackage("com.onyx.neoservice");
|
||||
// } else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G122JPlatform) {
|
||||
|
||||
} else {
|
||||
intent.setPackage("com.android.settings");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user