regarding tasker, it's unclear exactly what you mean by:
This only works some times.
i would suspect the network connection is down because the device is sleeping. if tasker wakes your
app at 6 and your app immediately tries to download a file, there will be no network connection. if your
app doesn't wait a little and try again, there will be no download. i'm guessing tasker's job is to wake the
device at 6 and to hand things off to it, and that's that. i have no idea how your app goes about doing
what it's supposed to do.
i think you will find it easier to have a look at your app and to keep using tasker than to try to handle this on
your own. tasker seems to have mastered what could take you a long time to get a handle on. starting
actions at a given time is proving very constrained with each passing version of android.