android-download-manager

WebView not loading the file from internal storage

核能气质少年 提交于 2019-12-11 05:09:37
问题 I am trying to download HTML files from server then load it in webview. The files are being downloaded but they are not loading in the webview. Webview says net::ERR_FILE_NOT_FOUND even after restarting the app when the download completes. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); webView = (WebView) findViewById(R.id.webView); button = (Button) findViewById(R.id.button); webView.loadUrl("file://"

Want to open downloaded file in appropriate application in Android

…衆ロ難τιáo~ 提交于 2019-12-11 02:48:19
问题 I have to download a document from my server, to my app and save into a private folder. The document can be anything like .doc, .pdf, .docs, .jpg etc. Now, what I want is, after the download is completed, I show an Alert Dialog to open the document. When I click on the pen button then open that particular file in an appropriate application and if the app is not available, then show Dialog to download app. Give me some hint on this. Thanks in advance. 回答1: Try this way: Mails attachment open

Android DownloadManager save to Download folder

﹥>﹥吖頭↗ 提交于 2019-12-10 23:51:16
问题 I'm using DownloadManager to download file, I wanted to put the downloads in the standard download folder so people could easily find them using file manager looking in the most obvious place: Uri downloadLocation = Uri.fromFile(new File(Environment.DIRECTORY_DOWNLOADS, filename)); request.setDestinationUri(downloadLocation); Long reference = downloadManager.enqueue(request); But I get an exception because that isn't an external drive. Is there no way to download a file to the user's download

Android Oreo (API26) and android.app.DownloadManager

妖精的绣舞 提交于 2019-12-10 19:28:27
问题 Folks! This code doesn't work on Android Oreo (but ok on older versions, I can see notifications and the DownloadManager.ACTION_DOWNLOAD_COMPLETE broadcast message). Kotlin testButton.setOnClickListener { val downloadManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager val uri = Uri.parse("[url for a mp3 file]") val request = DownloadManager.Request(uri) request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI) request.setAllowedOverRoaming(false) request

Android apk expansion file - optional

最后都变了- 提交于 2019-12-10 15:57:22
问题 Can I use main expansion file as optional download option in application? So I don't need download it with APK file but later when user would do it. 回答1: When you create an expansion file, it should be something like [main|patch].<version>.<package_name> main, is for files that you're app needs to run, so you choose patch. The version is the same apk version you are uploading the expansion file with. If your apk version is 7 you should name the expansion file as follow: patch.7.com

Hide downloads from download manager android

牧云@^-^@ 提交于 2019-12-10 13:33:19
问题 I am implementing a mp3 downloader for android. I am using native DownloadManager service. Obviously, when I download a file, it also shows the downloading(or downloaded) file in the Download Manager app. I want to hide the downloaded file from Downloaded Manager i.e. I don't want the file to be displayed in the download manager list. Is there any way to acheive this? 回答1: Try setVisibleInDownloadsUi() on your DownloadManager.Request . 来源: https://stackoverflow.com/questions/20950597/hide

Is it okay to Query the DownloadManager on the UI Thread?

允我心安 提交于 2019-12-10 13:08:46
问题 The DownloadManager has a method query(). My question is if it's okay to call this method on the UI Thread, or if it should only be called from a background thread? Can calling it ever cause an ANR? 回答1: If one looks at the source of the query() method: public Cursor query(Query query) { Cursor underlyingCursor = query.runQuery(mResolver, UNDERLYING_COLUMNS, mBaseUri); if (underlyingCursor == null) { return null; } return new CursorTranslator(underlyingCursor, mBaseUri); } ... this could be

Pause android DownloadManager

左心房为你撑大大i 提交于 2019-12-10 13:06:03
问题 In my application I'm downloading movies from the server. Some of them are very big (4gb or more). I tried to implement my own download manager as a service and it was not quit good. On some devices the app just crashes into itself without any notice, and overall the download seems to be too slowly. So, I wanted to use Android's default DownloadManager, but my only problem is that I can't pause/resume it. Is there a way to implement that? 回答1: From what I can tell by looking at the source

Android DownloadManager - Download apk and install it

久未见 提交于 2019-12-10 12:04:45
问题 I have looked everywhere to find out how to download a APK that is not from the market place. The APK is stored in my server. All the sample did not work. I want my App to download an APK for my server and promt the user to install it. So far I managed to download the apk onto the user sd. but I can't get he path where is it saved and get to install it. private void downloadAPK() { String url="https://www.example.com/app.apk”; downloadManager = (DownloadManager) getSystemService(DOWNLOAD

DownloadManager doesn't send broadcast after INSUFFICIENT_SPACE_ERROR

痞子三分冷 提交于 2019-12-10 02:39:33
问题 The problem If the cache directory is full, trying to execute a simple request will fail without sending the DownloadManager.ACTION_DOWNLOAD_COMPLETE broadcast. Note: The problem is general but can be mostly reproduced on low-end devices with limited cache ( /data/data/com.android.providers.downloads/cache ) size. The code The receiver is configured correctly, as I'm still getting the broadcast when the operation succeeds and fails for other reasons. DownloadManager.Request request = new