« first day  last day (15 days later) » 

12:00 AM
@DJFriar I happens to see your question again in tag stackoverflow.com/questions/54276448/… :D
 
12:19 AM
Yeah, I'm actually about to post a new question related to the suggestion to use DownloadManager.
 
12:51 AM
@DJFriar just like white Mike said in the comment main method is not a thing in Android cuz it is the Operating system who lunch the app :)
Just rename your "main" to anything else and remove the optional String[] args parameter.
Inside your oncreate just do this fileDownloader.myNewMethod();
Note: Remove the new keyword
Although Android will complain since you are doing it in the Main thread better call the method above in AsyncTask
 
1:08 AM
Are you referring to the question about the downloader or the one about the delete existing file not working?
 
Ah. I ended up going with the DownloadManager method that was suggested in the comments.
 
Ah I see
 
I posted a new question related to DownloadManager though: stackoverflow.com/questions/54282286/…
 
1:21 AM
File dirr = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
File dataFile = new File(dirr , "Tour of Honor/" + filename);
@DJFriar ^
Btw I notice an extra slash `/`
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOCUMENTS, "/Tour of Honor/" + "/" + "BonusData" + ".json")
 
1:57 AM
I fixed the slash one, though that was only in the log it seems, as in the actual file save it was working.
 
How about the delete method? Is it working now?
 
I'm editing it right now
public boolean deleteFile( String filename){

File dataDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
File dataFile = new File(dataDirectory , "Tour of Honor/" + filename);
return dataFile.delete();
}
 
Do it also in isFileExists
 
it still created a BonusData-1.json file
public boolean isFileExists(String filename){

File dataDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
File dataFile = new File(dataDirectory , "Tour of Honor/" + filename);
String dataFilePath = dataFile.getAbsolutePath();
Log.e("splashScrn isFileExists", "File Found: " + dataFilePath);
return dataFile.exists();
}
The log output was /storage/emulated/0/Documents/Tour of Honor/BonusData.json
 
Ok it seems the problem is the extra !
if (!isFileExists("BonusData.json"))
to
if (isFileExists("BonusData.json"))
 
2:09 AM
well I feel dumb. But yes, that worked
 
xd
It happens
Small typo like that can me you bald :D
 
no kidding. .ol
lol
 
I experience a similar situation xd
 
Now I just need to get it to read that file to populate the SQL db. Baby steps
 
cool
 

« first day  last day (15 days later) »