假装调一下
This commit is contained in:
parent
2bfea5693c
commit
86ce2449e5
@ -17,8 +17,8 @@ public class DownLoadBroadcastReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
long currentDownloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
|
||||
SharedPreferences sPreferences = context.getSharedPreferences("jerry_rn_a_version_upgrade", 0);
|
||||
long refernece = sPreferences.getLong("downloadId", 0);
|
||||
if (currentDownloadId == refernece) {
|
||||
long reference = sPreferences.getLong("downloadId", 0);
|
||||
if (currentDownloadId == reference) {
|
||||
DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
Intent install = new Intent(Intent.ACTION_VIEW);
|
||||
DownloadManager.Query queryById = new DownloadManager.Query();
|
||||
|
@ -75,9 +75,10 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
||||
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI);
|
||||
request.setMimeType("application/vnd.android.package-archive");
|
||||
request.setTitle(this.title);
|
||||
request.setAllowedOverRoaming(false);
|
||||
request.setDestinationInExternalFilesDir(activity, Environment.DIRECTORY_DOWNLOADS, "");
|
||||
long downloadId = downloadManager.enqueue(request);
|
||||
SharedPreferences sharedPreferences = activity.getSharedPreferences("jerry_rn_a_version_upgrade", 0);
|
||||
sharedPreferences.edit().putLong("downloadId", downloadId).apply();
|
||||
sharedPreferences.edit().putLong("downloadId", downloadId).commit();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user