From 15cd8aa333837c75ab2ada7e7d98dd4eecc838d0 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Fri, 18 Dec 2020 09:14:23 +0700 Subject: [PATCH] chore(android/engine): Cleanup comments --- .../tavultesoft/kmea/cloud/CloudApiTypes.java | 1 - .../tavultesoft/kmea/cloud/CloudDownloadMgr.java | 16 ++++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/android/KMEA/app/src/main/java/com/tavultesoft/kmea/cloud/CloudApiTypes.java b/android/KMEA/app/src/main/java/com/tavultesoft/kmea/cloud/CloudApiTypes.java index 3966c89a86..b7ebae8a61 100644 --- a/android/KMEA/app/src/main/java/com/tavultesoft/kmea/cloud/CloudApiTypes.java +++ b/android/KMEA/app/src/main/java/com/tavultesoft/kmea/cloud/CloudApiTypes.java @@ -3,7 +3,6 @@ package com.tavultesoft.kmea.cloud; import android.app.DownloadManager; import android.content.Context; import android.net.Uri; -import android.util.Log; import androidx.annotation.NonNull; diff --git a/android/KMEA/app/src/main/java/com/tavultesoft/kmea/cloud/CloudDownloadMgr.java b/android/KMEA/app/src/main/java/com/tavultesoft/kmea/cloud/CloudDownloadMgr.java index 186e234475..1f24c9e6ef 100644 --- a/android/KMEA/app/src/main/java/com/tavultesoft/kmea/cloud/CloudDownloadMgr.java +++ b/android/KMEA/app/src/main/java/com/tavultesoft/kmea/cloud/CloudDownloadMgr.java @@ -240,19 +240,15 @@ public class CloudDownloadMgr{ */ private CloudApiTypes.SingleCloudDownload createRequest(Context aContext, int aNo, CloudApiTypes.CloudApiParam aParam) { - - // From DownloadManager documentation: - // https://developer.android.com/reference/android/app/DownloadManager.Request#setDestinationUri(android.net.Uri) - // Must be a file to a path on external storage, and the calling app must have the WRITE_EXTERNAL_STORAGE permission - //File _file=new File(aContext.getExternalFilesDir(null),"download_"+System.currentTimeMillis()+"_"+aNo); - /* - Create a DownloadManager.Request with all the information necessary to start the download - */ + /* + * Create a DownloadManager.Request with all the information necessary to start the download + * Not using setDestinationUri so we can avoid requesting WRITE_EXTERNAL_STORAGE permission + * https://developer.android.com/reference/android/app/DownloadManager.Request#setDestinationUri(android.net.Uri) + */ DownloadManager.Request _request=new DownloadManager.Request(Uri.parse(aParam.url)) .setTitle("Cloud Download " + aParam.target) .setDescription("Downloading " + aParam.target) - .setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE);// Visibility of the download Notification - //.setDestinationUri(Uri.fromFile(_file));// Uri of the destination file + .setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE); // Visibility of the download Notification // api level 24 //.setRequiresCharging(false)// Set if charging is required to begin the download //.setAllowedOverMetered(true)// Set if download is allowed on Mobile network