android-download-manager

Android: detect when app is installed

≡放荡痞女 提交于 2019-11-27 22:50:17
问题 I am trying to download an Android app from a server using the DownloadManager class, install it and then detect when the installation is completed. I am using two receivers: one to detect the download process and the other to detect the install process. The first receiver works properly, but the second doesn't. What I am doing wrong? DownloadManager dm = (DownloadManager) DownloadApplicationActivity.this.getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Request req = new

How to get programmatically the data usage limit set by user on Android OS configuration?

两盒软妹~` 提交于 2019-11-27 20:38:33
User can define at Data Usage screen a limite and/or a warning limit for mobile data usage. So how can I get this information by code? Screen of Data Usage configuration of native OS. I wanna the limit value and warning value. I've already tried this but not work and always return NULL to both: final Long recommendedBytes = DownloadManager.getRecommendedMaxBytesOverMobile( this.context ); final Long maximumBytes = DownloadManager.getMaxBytesOverMobile( this.context ); // recommendedBytes and maximumBytes are NULL And TrafficStats class just have a data transferred not the limits. Marcelo Filho

Show Download Manager progress inside activity

会有一股神秘感。 提交于 2019-11-27 13:01:26
问题 I used Download Manager class inside my activity to perform downloads; it works fine and my next task is to show the same progress percentage inside my activity. I am not sure how to do it. My code so far public class DownloadSampleBook extends Activity{ private long enqueue; private DownloadManager dm; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample

Unknown URL content://downloads/my_downloads

倾然丶 夕夏残阳落幕 提交于 2019-11-27 10:50:36
问题 I'm using Download Manger for download some multimedia files and categorize them. I'm also using Crashlytics and this is an error I frequently get it on different devices and versions of Android. I'm looking for your solutions/suggestion! java.lang.IllegalArgumentException: Unknown URL content://downloads/my_downloads at android.content.ContentResolver.insert(ContentResolver.java:862) at android.app.DownloadManager.enqueue(DownloadManager.java:1252) at com.myapp.LessonFragment

How to download files from webview Android?

。_饼干妹妹 提交于 2019-11-27 08:43:23
My code below loads the url page fine and after searching for a song when I click on the download link it crashes. There aren't so much tutorials on how to get the download manager to work with a webview. What am I doing wrong? import java.io.File; import android.app.Activity; import android.app.DownloadManager; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.webkit.WebView; import android.webkit.WebViewClient; public class List1 extends Activity { WebView ourBrow; @Override public void onCreate(Bundle

How to download a file from a server and save it in specific folder in SD card in Android?

丶灬走出姿态 提交于 2019-11-27 03:31:53
I have one requirement in my Android application. I need to download and save file in specific folder of SD card programmatically. I have developed source code, which is String DownloadUrl = "http://myexample.com/android/"; String fileName = "myclock_db.db"; DownloadDatabase(DownloadUrl,fileName); // and the method is public void DownloadDatabase(String DownloadUrl, String fileName) { try { File root = android.os.Environment.getExternalStorageDirectory(); File dir = new File(root.getAbsolutePath() + "/myclock/databases"); if(dir.exists() == false){ dir.mkdirs(); } URL url = new URL("http:/

Download Manger not working in Android Pie 9.0 (Xiaomi mi A2)

最后都变了- 提交于 2019-11-27 02:03:15
On updating the device OS to Android 9.0 , previously this code was working fine( Xiaomi mi A2 ). Now, files are not being downloaded on Android Pie 9.0 . Moreover it is working fine in Oreo, Nougat , Marshmallow Here is the code snippet: File myDir = new File(Environment.getExternalStorageDirectory(), "MyApp"); if (!myDir.exists()) { myDir.mkdirs(); } String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date()); DownloadManager mgr = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); Uri downloadUri = Uri.parse(url); DownloadManager

How to get programmatically the data usage limit set by user on Android OS configuration?

笑着哭i 提交于 2019-11-26 22:53:58
问题 User can define at Data Usage screen a limite and/or a warning limit for mobile data usage. So how can I get this information by code? Screen of Data Usage configuration of native OS. I wanna the limit value and warning value. I've already tried this but not work and always return NULL to both: final Long recommendedBytes = DownloadManager.getRecommendedMaxBytesOverMobile( this.context ); final Long maximumBytes = DownloadManager.getMaxBytesOverMobile( this.context ); // recommendedBytes and

How to download files from webview Android?

穿精又带淫゛_ 提交于 2019-11-26 17:46:33
问题 My code below loads the url page fine and after searching for a song when I click on the download link it crashes. There aren't so much tutorials on how to get the download manager to work with a webview. What am I doing wrong? import java.io.File; import android.app.Activity; import android.app.DownloadManager; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.webkit.WebView; import android.webkit.WebViewClient;

Download Manger not working in Android Pie 9.0 NetworkSecurityConfig: No Network Security Config specified, using platform default

痞子三分冷 提交于 2019-11-26 08:28:29
问题 On updating the device OS to Android 9.0 , previously this code was working fine( Xiaomi mi A2 ). Now, files are not being downloaded on Android Pie 9.0 . Moreover it is working fine in Oreo, Nougat , Marshmallow Here is the code snippet: File myDir = new File(Environment.getExternalStorageDirectory(), \"MyApp\"); if (!myDir.exists()) { myDir.mkdirs(); } String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.getDefault()).format(new Date()); DownloadManager mgr = (DownloadManager