lingochamp / okdownload

A Reliable, Flexible, Fast and Powerful download engine.
Apache License 2.0
5.19k stars 776 forks source link

BreakPointInfo #395

Closed sametbars closed 4 years ago

sametbars commented 4 years ago

OkDownload Version

v1.0.7

Problem Describe

BreakpointInfo is not always stored into the database (mostly happening on mobile data)

BreakpointInfo breakpointInfo = OkDownload.with().breakpointStore().get(id); this still returns true but It won't store in database, after restarting the app, it will download form the beginning

I have to insert it manually after an error like this:

BreakpointInfo breakpointInfo = OkDownload.with().breakpointStore().get(id);
if(breakpointInfo != null){
    BreakpointSQLiteHelper breakpointSQLiteHelper = new BreakpointSQLiteHelper(context);
    try {
        breakpointSQLiteHelper.insert(breakpointInfo);
    } catch (Exception | Error ex) {
        ex.printStackTrace();
        try {
            breakpointSQLiteHelper.updateInfo(breakpointInfo);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}