attempt to fix uri

This commit is contained in:
X1nto 2020-07-11 18:12:03 +04:00
parent 89d8be8cdc
commit 1224e01823
3 changed files with 6 additions and 5 deletions

View File

@ -23,6 +23,7 @@ import com.vanced.manager.utils.InternetTools.getObjectFromJson
import com.vanced.manager.utils.NotificationHelper
import com.vanced.manager.utils.NotificationHelper.cancelNotif
import com.vanced.manager.utils.NotificationHelper.createBasicNotif
import java.io.File
class MicrogDownloadService: Service() {
@ -43,7 +44,7 @@ class MicrogDownloadService: Service() {
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
request.setTitle(getString(R.string.downloading_file, "MicroG"))
request.setDestinationUri(Uri.parse("${filesDir.path}/microg.apk"))
request.setDestinationUri(Uri.fromFile(File("${filesDir.path}/microg.apk")))
val downloadManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
downloadId = downloadManager.enqueue(request)

View File

@ -25,6 +25,7 @@ import com.vanced.manager.utils.InternetTools.getObjectFromJson
import com.vanced.manager.utils.NotificationHelper.cancelNotif
import com.vanced.manager.utils.NotificationHelper.createBasicNotif
import com.vanced.manager.utils.NotificationHelper.displayDownloadNotif
import java.io.File
class VancedDownloadService: Service() {
@ -69,7 +70,7 @@ class VancedDownloadService: Service() {
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
request.setTitle(getString(R.string.downloading_file, "MicroG"))
request.setDestinationUri(Uri.parse("${filesDir.path}/${getFileNameFromUrl(url)}"))
request.setDestinationUri(Uri.fromFile(File("${filesDir.path}/${getFileNameFromUrl(url)}")))
val downloadManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
downloadId = downloadManager.enqueue(request)

View File

@ -77,15 +77,14 @@ class UpdateCheckFragment : DialogFragment() {
}
private fun upgradeManager() {
val dwnldUrl = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/manager.json")
.get("url").asString
val dwnldUrl = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/manager.json").get("url").asString
//val loadBar = view?.findViewById<ProgressBar>(R.id.update_center_progressbar)
val request = DownloadManager.Request(Uri.parse(dwnldUrl))
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
request.setTitle(activity?.getString(R.string.downloading_file, "Manager"))
request.setDestinationUri(Uri.parse("${activity?.filesDir?.path}/manager.apk"))
request.setDestinationUri(Uri.fromFile(File("${activity?.filesDir?.path}/manager.apk")))
val downloadManager = activity?.getSystemService(DOWNLOAD_SERVICE) as DownloadManager
downloadId = downloadManager.enqueue(request)