version:2.0
fix:修复不能初始化推送,修复地图定位,修复下载缓存乱码 update:
This commit is contained in:
@@ -73,8 +73,8 @@ android {
|
|||||||
|
|
||||||
official {
|
official {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 10
|
versionCode 11
|
||||||
versionName "1.9"
|
versionName "2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ public class AmapManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initAmap() {
|
public void initAmap() {
|
||||||
|
if (mLocationClient == null) {
|
||||||
mLocationClient = new LocationClient(mContext);
|
mLocationClient = new LocationClient(mContext);
|
||||||
|
}
|
||||||
mLocationClient.setLocOption(getDefaultLocationClientOption());
|
mLocationClient.setLocOption(getDefaultLocationClientOption());
|
||||||
mLocationClient.registerLocationListener(mListener);
|
mLocationClient.registerLocationListener(mListener);
|
||||||
mLocationClient.stop();
|
mLocationClient.stop();
|
||||||
|
|||||||
@@ -1080,7 +1080,9 @@ public class NetInterfaceManager {
|
|||||||
if (ConnectManager.getInstance().isNeedConnect(JGYUtils.FUXIAOYING_KEY, connectMode)) {
|
if (ConnectManager.getInstance().isNeedConnect(JGYUtils.FUXIAOYING_KEY, connectMode)) {
|
||||||
checkFXYAppUpdate(lifecycle, callback);
|
checkFXYAppUpdate(lifecycle, callback);
|
||||||
} else {
|
} else {
|
||||||
String jsonString = mCacheHelper.getAsString(JGYUtils.FUXIAOYING_KEY);
|
//有乱码
|
||||||
|
String jsonString = mMMKV.decodeString(JGYUtils.FUXIAOYING_KEY + "_mmkv");
|
||||||
|
Log.e(TAG, "checkFXYAppUpdate: jsonString = " + jsonString);
|
||||||
//为 "" 是已经请求成功的
|
//为 "" 是已经请求成功的
|
||||||
if (jsonString == null) {
|
if (jsonString == null) {
|
||||||
checkFXYAppUpdate(lifecycle, callback);
|
checkFXYAppUpdate(lifecycle, callback);
|
||||||
@@ -1928,7 +1930,7 @@ public class NetInterfaceManager {
|
|||||||
softwareJson.addProperty("jpush_id", "");
|
softwareJson.addProperty("jpush_id", "");
|
||||||
softwareJson.addProperty("notice_version", ApkUtils.getAPPVersionName(mContext, "com.uiui.info"));
|
softwareJson.addProperty("notice_version", ApkUtils.getAPPVersionName(mContext, "com.uiui.info"));
|
||||||
softwareJson.addProperty("browser_version", ApkUtils.getAPPVersionName(mContext, "com.uiui.browser"));
|
softwareJson.addProperty("browser_version", ApkUtils.getAPPVersionName(mContext, "com.uiui.browser"));
|
||||||
softwareJson.addProperty("desktop_version", ApkUtils.getAPPVersionName(mContext, "com.uiui.os"));
|
softwareJson.addProperty("desktop_version", ApkUtils.getAPPVersionName(mContext, "com.fuying.fuxiaoying"));
|
||||||
|
|
||||||
String addr = jsonObject.toString();
|
String addr = jsonObject.toString();
|
||||||
String machine = Utils.getMachine(mContext);
|
String machine = Utils.getMachine(mContext);
|
||||||
|
|||||||
@@ -21,11 +21,15 @@ import android.provider.Settings;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.baidu.location.BDAbstractLocationListener;
|
||||||
|
import com.baidu.location.BDLocation;
|
||||||
|
import com.baidu.location.LocationClient;
|
||||||
import com.blankj.utilcode.util.NetworkUtils;
|
import com.blankj.utilcode.util.NetworkUtils;
|
||||||
import com.fuying.sn.BuildConfig;
|
import com.fuying.sn.BuildConfig;
|
||||||
import com.fuying.sn.bean.BaseResponse;
|
import com.fuying.sn.bean.BaseResponse;
|
||||||
import com.fuying.sn.bean.SnInfo;
|
import com.fuying.sn.bean.SnInfo;
|
||||||
import com.fuying.sn.config.CommonConfig;
|
import com.fuying.sn.config.CommonConfig;
|
||||||
|
import com.fuying.sn.manager.AmapManager;
|
||||||
import com.fuying.sn.manager.ConnectManager;
|
import com.fuying.sn.manager.ConnectManager;
|
||||||
import com.fuying.sn.manager.ControlManager;
|
import com.fuying.sn.manager.ControlManager;
|
||||||
import com.fuying.sn.network.NetInterfaceManager;
|
import com.fuying.sn.network.NetInterfaceManager;
|
||||||
@@ -110,7 +114,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
ToastUtil.show("网络已连接");
|
ToastUtil.show("网络已连接");
|
||||||
String WiFiAlias = Utils.getWifiAlias(this);
|
String WiFiAlias = Utils.getWifiAlias(this);
|
||||||
Log.e(TAG, "onConnected: WiFiAlias = " + WiFiAlias);
|
Log.e(TAG, "onConnected: WiFiAlias = " + WiFiAlias);
|
||||||
Utils.getPublicIP(this);
|
|
||||||
if (ConnectManager.getInstance().isWiFiFistConnect()) {
|
if (ConnectManager.getInstance().isWiFiFistConnect()) {
|
||||||
start.onstar(ConnectManager.WIFI_LAST_CONNECT_TIME);
|
start.onstar(ConnectManager.WIFI_LAST_CONNECT_TIME);
|
||||||
} else {
|
} else {
|
||||||
@@ -119,11 +122,17 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//第一次开机联网后直接连接
|
//第一次开机联网后直接连接
|
||||||
if ((int) SPUtils.get(this, CommonConfig.JGY_FIRST_BOOT, 0) == 0) {
|
// TODO: 2022/11/21 有些设备联网了但是立刻请求还是失败
|
||||||
|
Handler.getMain().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if ((int) SPUtils.get(MainService.this, CommonConfig.JGY_FIRST_BOOT, 0) == 0) {
|
||||||
mPresenter.getSnInfo();
|
mPresenter.getSnInfo();
|
||||||
mPresenter.getAllApp();
|
mPresenter.getAllApp();
|
||||||
SPUtils.put(this, CommonConfig.JGY_FIRST_BOOT, 1);
|
SPUtils.put(MainService.this, CommonConfig.JGY_FIRST_BOOT, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}, 15000);
|
||||||
sendDeviceInfo();
|
sendDeviceInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,8 +159,14 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
mPresenter.setLifecycle(lifecycleSubject);
|
mPresenter.setLifecycle(lifecycleSubject);
|
||||||
mPresenter.attachView(this);
|
mPresenter.attachView(this);
|
||||||
|
|
||||||
|
Handler.getMain().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
NTPTimeTask task = new NTPTimeTask();
|
NTPTimeTask task = new NTPTimeTask();
|
||||||
task.execute("ntp.aliyun.com");
|
task.execute("ntp.aliyun.com");
|
||||||
|
mPresenter.getAllApp();
|
||||||
|
}
|
||||||
|
}, 20000);
|
||||||
|
|
||||||
Log.e(TAG, "onCreate: IMEI = " + Utils.getIMEI(MainService.this));
|
Log.e(TAG, "onCreate: IMEI = " + Utils.getIMEI(MainService.this));
|
||||||
String aole_app_forbid = Settings.System.getString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID);
|
String aole_app_forbid = Settings.System.getString(getContentResolver(), CommonConfig.AOLE_ACTION_APP_FORBID);
|
||||||
@@ -159,7 +174,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
if (TextUtils.isEmpty(aole_app_forbid)) {
|
if (TextUtils.isEmpty(aole_app_forbid)) {
|
||||||
ApkUtils.writeAppPackageList(MainService.this, "");
|
ApkUtils.writeAppPackageList(MainService.this, "");
|
||||||
}
|
}
|
||||||
mPresenter.getAllApp();
|
|
||||||
|
|
||||||
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||||
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||||
@@ -174,6 +188,10 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
.throttleFirst(6, TimeUnit.HOURS)
|
.throttleFirst(6, TimeUnit.HOURS)
|
||||||
.subscribe(timeObserver);
|
.subscribe(timeObserver);
|
||||||
|
|
||||||
|
Observable.create(configsubscribe)
|
||||||
|
.throttleLast(15, TimeUnit.SECONDS)
|
||||||
|
.subscribe(configObserver);
|
||||||
|
|
||||||
if ((int) SPUtils.get(this, CommonConfig.JGY_FIRST_CONNECT, 0) == 0) {
|
if ((int) SPUtils.get(this, CommonConfig.JGY_FIRST_CONNECT, 0) == 0) {
|
||||||
start.onstar(ConnectManager.REBOOT_LAST_ONNECT_TIME);
|
start.onstar(ConnectManager.REBOOT_LAST_ONNECT_TIME);
|
||||||
}
|
}
|
||||||
@@ -217,19 +235,72 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
Handler.getMain().postDelayed(new Runnable() {
|
Handler.getMain().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
initConfig();
|
||||||
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
||||||
NetInterfaceManager.getInstance().updateAdminInfo();
|
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||||
}
|
}
|
||||||
},10000);
|
}, 15000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
Log.e(TAG, "onStartCommand: " + System.currentTimeMillis());
|
Log.e(TAG, "onStartCommand: " + System.currentTimeMillis());
|
||||||
|
configStart.onstar("onStartCommand");
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initConfig() {
|
||||||
|
tPushInit();
|
||||||
|
Utils.getPublicIP(MainService.this);
|
||||||
|
LocationClient locationClient = AmapManager.getInstance().getLocationClient();
|
||||||
|
locationClient.stop();
|
||||||
|
locationClient.start();
|
||||||
|
locationClient.registerLocationListener(new BDAbstractLocationListener() {
|
||||||
|
@Override
|
||||||
|
public void onReceiveLocation(BDLocation bdLocation) {
|
||||||
|
Log.e("initConfig", "onReceiveLocation: ");
|
||||||
|
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private interface ConfigStart {
|
||||||
|
void onstar(String key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConfigStart configStart;
|
||||||
|
|
||||||
|
private ObservableOnSubscribe<String> configsubscribe = new ObservableOnSubscribe<String>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||||
|
configStart = emitter::onNext;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private Observer<String> configObserver = new Observer<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(String string) {
|
||||||
|
Log.e(TAG, "onNext: " + System.currentTimeMillis() + "\t" + string);
|
||||||
|
initConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|||||||
Reference in New Issue
Block a user