Keep apk downloads from crashing on 2.2
Use a temporary quick fix for the crash until a better solution is in place. This is explained in the TODO. Fixes #448.
This commit is contained in:
parent
8d4e785185
commit
7b8f577fd4
@ -283,6 +283,14 @@ public class AsyncDownloaderFromAndroid implements AsyncDownloader {
|
|||||||
* @return -1 if not downloading, else the id from the Android download manager
|
* @return -1 if not downloading, else the id from the Android download manager
|
||||||
*/
|
*/
|
||||||
public static long isDownloading(Context context, String uniqueDownloadId) {
|
public static long isDownloading(Context context, String uniqueDownloadId) {
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) {
|
||||||
|
// TODO: remove. This is necessary because AppDetails calls this
|
||||||
|
// static method directly, without using the whole pipe through
|
||||||
|
// DownloaderFactory. This shouldn't be called at all on android-8
|
||||||
|
// devices, since AppDetails is really using the old downloader,
|
||||||
|
// not this one.
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||||
DownloadManager.Query query = new DownloadManager.Query();
|
DownloadManager.Query query = new DownloadManager.Query();
|
||||||
Cursor c = dm.query(query);
|
Cursor c = dm.query(query);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user