version:3.0.5_beta
update:2020.06.23 fix:加入锁屏息屏发送时间,加入电池优化 add:
This commit is contained in:
@@ -15,10 +15,10 @@ android {
|
|||||||
minSdkVersion 20
|
minSdkVersion 20
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
||||||
// versionCode 148
|
versionCode 148
|
||||||
// versionName "3.0.5"//测试jiaoguanyi.cn
|
versionName "3.0.5"//测试jiaoguanyi.cn
|
||||||
versionCode 1002
|
// versionCode 1002
|
||||||
versionName "2.0.1.2"// 正式jiaoguanyi.com 双数正式 单数测试
|
// versionName "2.0.1.2"// 正式jiaoguanyi.com 双数正式 单数测试
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.Network;
|
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.net.wifi.WifiInfo;
|
import android.net.wifi.WifiInfo;
|
||||||
@@ -38,6 +37,8 @@ import com.mjsheng.myappstore.activity.MainActivity;
|
|||||||
import com.mjsheng.myappstore.comm.CommonDatas;
|
import com.mjsheng.myappstore.comm.CommonDatas;
|
||||||
import com.mjsheng.myappstore.jpush.TagAliasOperatorHelper;
|
import com.mjsheng.myappstore.jpush.TagAliasOperatorHelper;
|
||||||
import com.mjsheng.myappstore.network.HTTPInterface;
|
import com.mjsheng.myappstore.network.HTTPInterface;
|
||||||
|
import com.mjsheng.myappstore.network.Network;
|
||||||
|
import com.mjsheng.myappstore.network.api.newapi.GetLockState;
|
||||||
import com.mjsheng.myappstore.server.GuardService;
|
import com.mjsheng.myappstore.server.GuardService;
|
||||||
import com.mjsheng.myappstore.server.InitJpushServer;
|
import com.mjsheng.myappstore.server.InitJpushServer;
|
||||||
import com.mjsheng.myappstore.server.StepService;
|
import com.mjsheng.myappstore.server.StepService;
|
||||||
@@ -53,6 +54,7 @@ import org.lzh.framework.updatepluginlib.UpdateConfig;
|
|||||||
import org.lzh.framework.updatepluginlib.base.UpdateParser;
|
import org.lzh.framework.updatepluginlib.base.UpdateParser;
|
||||||
import org.lzh.framework.updatepluginlib.model.CheckEntity;
|
import org.lzh.framework.updatepluginlib.model.CheckEntity;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@@ -66,8 +68,14 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
import cn.jpush.android.api.JPushInterface;
|
import cn.jpush.android.api.JPushInterface;
|
||||||
import cn.jpush.android.api.JPushMessage;
|
import cn.jpush.android.api.JPushMessage;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.Scheduler;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import rx.functions.Action1;
|
import rx.functions.Action1;
|
||||||
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
|
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
|
||||||
@@ -148,10 +156,10 @@ public class MyApplication extends MultiDexApplication {
|
|||||||
if (!BuildConfig.DEBUG) {
|
if (!BuildConfig.DEBUG) {
|
||||||
catchException();
|
catchException();
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
//8.0之后需要在
|
//8.0之后需要在
|
||||||
registerTimeReceiver();
|
registerTimeReceiver();
|
||||||
}
|
// }
|
||||||
ignoreBatteryOptimization(this);
|
ignoreBatteryOptimization(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -198,9 +206,8 @@ public class MyApplication extends MultiDexApplication {
|
|||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
Log.e("fht", "receiver action:" + action);
|
Log.e("fht", "receiver action:" + action);
|
||||||
if (action.equals(Intent.ACTION_USER_PRESENT)
|
if (action.equals(Intent.ACTION_SCREEN_ON)
|
||||||
|| action.equals(Intent.ACTION_SCREEN_ON)
|
|| action.equals(Intent.ACTION_USER_PRESENT)
|
||||||
|| action.equals(Intent.ACTION_SCREEN_OFF)
|
|
||||||
) {
|
) {
|
||||||
time2 = System.currentTimeMillis();
|
time2 = System.currentTimeMillis();
|
||||||
if ((time2 - time1) > 60 * 1000) {
|
if ((time2 - time1) > 60 * 1000) {
|
||||||
@@ -210,15 +217,53 @@ public class MyApplication extends MultiDexApplication {
|
|||||||
startService(new Intent(context, StepService.class));
|
startService(new Intent(context, StepService.class));
|
||||||
startService(new Intent(context, GuardService.class));
|
startService(new Intent(context, GuardService.class));
|
||||||
time1 = time2;
|
time1 = time2;
|
||||||
Log.e("fht", "onReceive");
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
getLockState("2", String.valueOf(time));
|
||||||
|
|
||||||
|
} else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
getLockState("1", String.valueOf(time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getLockState(String status, String time) {
|
||||||
|
GetLockState getLockState = Network.getLockState();
|
||||||
|
getLockState.getLockState(Utils.getSerial(), status, time)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<ResponseBody>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(ResponseBody responseBody) {
|
||||||
|
try {
|
||||||
|
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(responseBody.string());
|
||||||
|
int code = jsonObject.getInteger("code");
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onTagOperatorResult(JPushMessage jPushMessage) {
|
public void onTagOperatorResult(JPushMessage jPushMessage) {
|
||||||
if (jPushMessage == null) {
|
if (jPushMessage == null) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.mjsheng.myappstore.network.api.RankAppApi;
|
|||||||
import com.mjsheng.myappstore.network.api.SystemSettingApi;
|
import com.mjsheng.myappstore.network.api.SystemSettingApi;
|
||||||
import com.mjsheng.myappstore.network.api.UpdateApi;
|
import com.mjsheng.myappstore.network.api.UpdateApi;
|
||||||
import com.mjsheng.myappstore.network.api.UploadAppInfoApi;
|
import com.mjsheng.myappstore.network.api.UploadAppInfoApi;
|
||||||
|
import com.mjsheng.myappstore.network.api.newapi.GetLockState;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -40,10 +41,10 @@ public class Network {
|
|||||||
// public static final String ROOT_URL = "http://www.as.xueshibao.com.cn/api/"; 弃用
|
// public static final String ROOT_URL = "http://www.as.xueshibao.com.cn/api/"; 弃用
|
||||||
// public static final String ROOT_URL = "https://www.jiaoguanyi.com/api/";//正式 弃用
|
// public static final String ROOT_URL = "https://www.jiaoguanyi.com/api/";//正式 弃用
|
||||||
|
|
||||||
public static final String ROOT_URL = "https://partner.jiaoguanyi.com/api/";//正式
|
// public static final String ROOT_URL = "https://partner.jiaoguanyi.com/api/";//正式
|
||||||
public static final String WebsocketURL = "ws://47.107.133.19:1234";
|
// public static final String WebsocketURL = "ws://47.107.133.19:1234";
|
||||||
// public static final String ROOT_URL = "http://www.jiaoguanyi.cn/api/";//测试
|
public static final String ROOT_URL = "http://www.jiaoguanyi.cn/api/";//测试
|
||||||
// public static final String WebsocketURL = "ws://47.107.133.19:2345";
|
public static final String WebsocketURL = "ws://47.107.133.19:2345";
|
||||||
|
|
||||||
private static UploadAppInfoApi uploadAppInfoApi;
|
private static UploadAppInfoApi uploadAppInfoApi;
|
||||||
private static DeselectIDApi deselectIDApi;
|
private static DeselectIDApi deselectIDApi;
|
||||||
@@ -58,6 +59,9 @@ public class Network {
|
|||||||
private static NetAndLaunchApi netAndLaunchApi;
|
private static NetAndLaunchApi netAndLaunchApi;
|
||||||
private static ForceDownloadApi forceDownloadApi;
|
private static ForceDownloadApi forceDownloadApi;
|
||||||
|
|
||||||
|
private static GetLockState getLockState;
|
||||||
|
|
||||||
|
|
||||||
private static final long cacheSize = 1024 * 1024 * 20;// 缓存文件最大限制大小20M
|
private static final long cacheSize = 1024 * 1024 * 20;// 缓存文件最大限制大小20M
|
||||||
private static String cacheDirectory = Environment.getExternalStorageDirectory() + "/okttpcaches"; // 设置缓存文件路径
|
private static String cacheDirectory = Environment.getExternalStorageDirectory() + "/okttpcaches"; // 设置缓存文件路径
|
||||||
private static Cache cache = new Cache(new File(cacheDirectory), cacheSize); //
|
private static Cache cache = new Cache(new File(cacheDirectory), cacheSize); //
|
||||||
@@ -246,4 +250,18 @@ public class Network {
|
|||||||
Log.e("mjsheng", "forceDownloadApi");
|
Log.e("mjsheng", "forceDownloadApi");
|
||||||
return forceDownloadApi;
|
return forceDownloadApi;
|
||||||
}
|
}
|
||||||
|
public static GetLockState getLockState() {
|
||||||
|
if (getLockState == null) {
|
||||||
|
Retrofit retrofit = new Retrofit.Builder()
|
||||||
|
.client(cacheClient)
|
||||||
|
.baseUrl(ROOT_URL)
|
||||||
|
.addConverterFactory(gsonConverterFactory)
|
||||||
|
.addCallAdapterFactory(rxJavaCallAdapterFactory)
|
||||||
|
.build();
|
||||||
|
getLockState = retrofit.create(GetLockState.class);
|
||||||
|
}
|
||||||
|
Log.e("mjsheng", "forceDownloadApi");
|
||||||
|
return getLockState;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.mjsheng.myappstore.network.api.newapi;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
import retrofit2.http.Field;
|
||||||
|
import retrofit2.http.FormUrlEncoded;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
|
||||||
|
public interface GetLockState {
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("Application/getLockState")
|
||||||
|
Observable<ResponseBody> getLockState(
|
||||||
|
@Field("sn") String sn,
|
||||||
|
@Field("status") String status,
|
||||||
|
@Field("time") String time
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ public class BootReceiver extends BroadcastReceiver {
|
|||||||
|| intent.getAction().equals("android.intent.action.ACTION_POWER_CONNECTED")
|
|| intent.getAction().equals("android.intent.action.ACTION_POWER_CONNECTED")
|
||||||
|| intent.getAction().equals("android.intent.action.DATE_CHANGED")
|
|| intent.getAction().equals("android.intent.action.DATE_CHANGED")
|
||||||
|| intent.getAction().equals("android.intent.action.TIME_TICK")
|
|| intent.getAction().equals("android.intent.action.TIME_TICK")
|
||||||
|| intent.getAction().equals("android.intent.action.USER_PRESENT")
|
// || intent.getAction().equals("android.intent.action.USER_PRESENT")
|
||||||
|| intent.getAction().equals("android.intent.action.SCREEN_ON")
|
|| intent.getAction().equals("android.intent.action.SCREEN_ON")
|
||||||
|| intent.getAction().equals("android.intent.action.SCREEN_OFF")
|
|| intent.getAction().equals("android.intent.action.SCREEN_OFF")
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user