这是我遇到问题的代码行
int permissionCheck = ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.WRITE_EXTERNAL_STORAGE);
Run Code Online (Sandbox Code Playgroud)
它在我的内心 public class MainActivity extends AppCompatActivity {
没有选项可以导入任何东西
这是我的进口清单
这是我当前使用的代码
String iosjiUrl = "http://modapps.com/NotoCoji.ttf";
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(iosjiUrl));
request.setDescription("Sscrition");
request.setTitle("Somle");
// in order for this if to run, you must use the android 3.2 to compile your app
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "NotoColorji.ttf");
// get download service and enqueue file
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
Run Code Online (Sandbox Code Playgroud)
我无法找到一种方法让我等待文件下载。
我还尝试弄清楚如何进行异步,但无法弄清楚=/
再次感谢!