update:2020.05.22

fix:toast显示问题,唤醒服务问题
add:
This commit is contained in:
2020-05-22 16:48:28 +08:00
parent a9dbcb17a6
commit 3bd4a64371
12 changed files with 223 additions and 69 deletions

View File

@@ -17,10 +17,7 @@ public class BootReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Log.e("BootReceiver", intent.getAction());
if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
context.startService(new Intent(context, InitJpushServer.class));
context.startService(new Intent(context, StepService.class));
context.startService(new Intent(context, GuardService.class));
context.startService(new Intent(context, MyDownloadService.class));
startService(context);
} else if (
intent.getAction().equals("android.intent.action.BATTERY_CHANGED")
|| intent.getAction().equals("android.intent.action.BATTERY_CHANGED")
@@ -33,12 +30,17 @@ public class BootReceiver extends BroadcastReceiver {
|| intent.getAction().equals("android.intent.action.SCREEN_ON")
|| intent.getAction().equals("android.intent.action.SCREEN_OFF")
) {
Log.e("fht", "BootReceiver MSG" + intent.getAction());
context.startService(new Intent(context, InitJpushServer.class));
context.startService(new Intent(context, StepService.class));
context.startService(new Intent(context, GuardService.class));
context.startService(new Intent(context, MyDownloadService.class));
//除了USER_PRESENT应该都收不到
Log.e("fht", "BootReceiver MSG:" + intent.getAction());
startService(context);
}
}
private void startService(Context context) {
context.startService(new Intent(context, InitJpushServer.class));
context.startService(new Intent(context, StepService.class));
context.startService(new Intent(context, GuardService.class));
context.startService(new Intent(context, MyDownloadService.class));
}
}

View File

@@ -295,19 +295,10 @@ public class MyJPushReceiver extends BroadcastReceiver {
String str = jSONObject.optString("app_url");
Log.e("mymjsheng", "app_package::" + s);
Log.e("mymjsheng", "app_url::" + str);
SaveListUtils.addToList(s);
List<String> list = SaveListUtils.getList();
if (list != null) {
if (!list.contains(s)) {
SaveListUtils.addToList(s);
}
} else {
SaveListUtils.addToList(s);
}
SaveListUtils.addList(s);
SaveListUtils.sendForceAPP(mContext);
if (!AppUtils.isAppInstalled(s)) {
if (!SaveListUtils.isDownLoading(s)) {
(Aria.download(this)
.load(str)
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(s) + ".apk").setExtendField(s))
@@ -316,7 +307,6 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
} catch (Exception e) {
e.printStackTrace();
return;
}
}
@@ -493,7 +483,12 @@ public class MyJPushReceiver extends BroadcastReceiver {
switch (message) {
case MSG_DELETE:
if (!TextUtils.isEmpty(title)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (SaveListUtils.getlist().contains(title)) {
SaveListUtils.getlist().remove(title);
}
SaveListUtils.sendForceAPP(mContext);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
ApkUtils.uninstall(mContext, title);
} else {
ApkUtils.deleteApkInSilence(title);
@@ -520,7 +515,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
settingPowerOn(extras);
break;
case MSG_RESET:
Utils.doMasterClear(mContext);
Utils.doMasterClear(mContext);
break;
case MSG_INSTALL:
// mContext.sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));