This commit is contained in:
fht
2020-02-22 19:13:29 +08:00
parent a781113b30
commit 503d4146f6
11 changed files with 163 additions and 114 deletions

View File

@@ -7,6 +7,7 @@ import android.util.Log;
import com.mjsheng.myappstore.server.GuardService;
import com.mjsheng.myappstore.server.InitJpushServer;
import com.mjsheng.myappstore.server.MyDownloadService;
import com.mjsheng.myappstore.server.StepService;
public class BootReceiver extends BroadcastReceiver {
@@ -16,10 +17,27 @@ 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")) {
Intent i = new Intent(context, InitJpushServer.class);
context.startService(i);
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));
} else if (
intent.getAction().equals("android.intent.action.BATTERY_CHANGED")
|| intent.getAction().equals("android.intent.action.BATTERY_CHANGED")
|| intent.getAction().equals("android.intent.action.BATTERY_LOW")
|| intent.getAction().equals("android.intent.action.BATTERY_OKAY")
|| intent.getAction().equals("android.intent.action.ACTION_POWER_CONNECTED")
|| intent.getAction().equals("android.intent.action.DATE_CHANGED")
|| intent.getAction().equals("android.intent.action.TIME_TICK")
|| intent.getAction().equals("android.intent.action.USER_PRESENT")
|| intent.getAction().equals("android.intent.action.ACTION_SCREEN_ON")
|| intent.getAction().equals("android.intent.action.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));
}
}

View File

@@ -46,20 +46,20 @@ public class NewAppReceiver extends BroadcastReceiver {
allIntent.setAction(Utils.DOWNLOAD_ALLTASK_ACTION);
context.sendBroadcast(allIntent);
String packageName = intent.getDataString().replace("package:", "");
MyApplication.getInstance().removeDate(packageName);
// MyApplication.getInstance().removeDate(packageName);
Log.e(TAG, "安装了:" + packageName + "包名的程序");
Log.e("fht", "安装了:" + packageName + "包名的程序");
OkGo.post(Configure.HTTP_TAG_DOWNLOAD_URL)
.params("key", Configure.HTTP_KEY)
.params("sn", Utils.getSerial())
.params("package", packageName)
.tag(this)
.execute(new StringCallback() {
@Override
public void onSuccess(String s, Call call, Response response) {
}
});
// OkGo.post(Configure.HTTP_TAG_DOWNLOAD_URL)
// .params("key", Configure.HTTP_KEY)
// .params("sn", Utils.getSerial())
// .params("package", packageName)
// .tag(this)
// .execute(new StringCallback() {
// @Override
// public void onSuccess(String s, Call call, Response response) {
//
// }
// });
SaveListUtils.getDownLoadList().remove(packageName);//移除下载列表
// ToastTool.show("安装成功");
if (!packageName.equals(Utils.YOUNGSYSTEM_APP_TONGBU) && !packageName.equals(context.getPackageName())) {