Simple OTA implementation

This commit is contained in:
topjohnwu
2017-06-07 02:19:23 +08:00
parent efeddda328
commit 69e5bcd57d
9 changed files with 124 additions and 39 deletions
@@ -1,6 +1,5 @@
package com.topjohnwu.magisk.receivers;
import android.app.Activity;
import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -13,7 +12,7 @@ import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Utils;
public abstract class DownloadReceiver extends BroadcastReceiver {
public Activity activity;
public Context mContext;
public String mFilename;
long downloadID;
@@ -21,7 +20,7 @@ public abstract class DownloadReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
activity = (Activity) context;
mContext = context;
DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
String action = intent.getAction();
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {