This repository has been archived by the owner on Jul 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zhongyi Tong
committed
Aug 2, 2016
1 parent
6b1eba8
commit b875a23
Showing
8 changed files
with
75 additions
and
65 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/src/main/java/xyz/monkeytong/hongbao/utils/DownloadUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package xyz.monkeytong.hongbao.utils; | ||
|
||
import android.app.DownloadManager; | ||
import android.content.Context; | ||
import android.net.Uri; | ||
import android.os.Environment; | ||
|
||
import java.net.URI; | ||
|
||
import static android.content.Context.DOWNLOAD_SERVICE; | ||
|
||
/** | ||
* Created by Zhongyi on 8/1/16. | ||
*/ | ||
public class DownloadUtil { | ||
public void enqueue(String url, Context context) { | ||
DownloadManager.Request r = new DownloadManager.Request(Uri.parse(url)); | ||
r.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "Uber.apk"); | ||
r.allowScanningByMediaScanner(); | ||
r.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); | ||
DownloadManager dm = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE); | ||
dm.enqueue(r); | ||
} | ||
} |