Hi, I have an app that have already the DbxChooser Class.
I have also this code:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == DBX_CHOOSER_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
// Handle the result
DbxChooser.Result result = new DbxChooser.Result(data);
Log.d("TAG", "Link to selected file: " + result.getLink());I can see on Logcat the full dropbox link and if I paste it on chrome I can download the file automatically. I want to download this link to a Jave File Obeject because after that I have a method thate receive "File" object (Excel file) and read the excel file. I tried to implement a DownloadFileTask but I could not make it.
How can I download the excel file from a link to a File object ?
I have also the DropboxClientFactory class ready:
package com.tkdcenter.StudentsListFromExcel;
/**
* Created by Alex on 18/9/2018.
*/
import com.dropbox.core.DbxRequestConfig;
import com.dropbox.core.http.OkHttp3Requestor;
import com.dropbox.core.v2.DbxClientV2;
public class DropboxClientFactory {
public static DbxClientV2 getClient(String ACCESS_TOKEN) {
// Create Dropbox client
DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder("Flashcard Maker")
.withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient()))
.build();
DbxClientV2 client = new DbxClientV2(requestConfig, ACCESS_TOKEN);
return client;
}
}