我尝试使用okdownload库它是FileDownloader library
的新版本...我是android的新手,我没有找到任何使用{\ t \ t \ t \ t \ n \ n的教程{1}} ...
我的代码
FileDownloader library
我将public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String url = "https://firebasestorage.googleapis.com/v0/b/storynory-1e523.appspot.com/o/audio%2Ffear-interview-jana-andrew-west.mp3?alt=media&token=1a279250-baa4-490a-b165-a6b2ff718763";
String fileName = "my Photo2.mp3";
String dirPath = com.example.abdullah.myapplication.Utils.getRootDirPath(getApplicationContext());
task = new DownloadTask.Builder(url, dirPath)
.setFilename("my Photo2.mp3")
// the minimal interval millisecond for callback progress
.setMinIntervalMillisCallbackProcess(30)
// do re-download even if the task has already been completed in the past.
.setPassIfAlreadyCompleted(false)
.build();
task.enqueue(listener);
// cancel
task.cancel();
// execute task synchronized
task.execute(listener);
}
}
导入了我的gradle文件
我不知道如何使用这个库...请有人纠正我的代码!
答案 0 :(得分:0)
我从未使用过这个库,但是在一个网站上他们添加了一些核心" okdownload"以及:
实施" com.liulishuo.okdownload:okdownload:1.0.3"