Skip to content

Instantly share code, notes, and snippets.

@raziel23x
Created November 29, 2012 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raziel23x/4170208 to your computer and use it in GitHub Desktop.
Save raziel23x/4170208 to your computer and use it in GitHub Desktop.
add goo.im support
// Start
if(getUrl.toString().contains("goo.im")){
// do a dl then wait for timer
conn.connect();
Log.v("OTA::Download", "Waiting out timer");
publishProgress(-1); // pending on dialog
// dl the catch page then wait
is = new BufferedInputStream(conn.getInputStream());
os = new FileOutputStream(destFile);
// get the timer page all 15
byte[] buf = new byte[4096];
int nRead = -1;
while ((nRead = is.read(buf)) != -1) {
if (this.isCancelled()) break;
os.write(buf, 0, nRead);
}
// got hold page pause
try {
Thread.sleep(10500); // pause the async task for 10.5 seconds
} catch (InterruptedException e) {
// don't panic and reset the link
}
Log.v("OTA::Download", "Timer Complete, Continuing with File Download");
getUrl = new URL(info.url);
conn = getUrl.openConnection();
}
// end do your thing as normal
// begin progress snipplet
if (values[0] == -1) { // i'm not sure yet please hold
dialog.setIndeterminate(true);
return;
}
dialog.setIndeterminate(false); // make sure dialog is ALWAYS sure for progress
// end progress snipplet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment