Ok I just figured out how to get my app on the device (I did exported through Eclipse, and then zipalign on the command-line). I installed it, and ran it, and the download was roughly the same speed as when I run through the debugger on the device. This was with the USB cable disconnected as well. This is on an Android Dev Phone 2 (HTC Magic).
The only thing I can think is that I still had the debuggable flag set to true in the manifest when I exported, would this affect the speed on the device if not connected via USB? Rob On Mar 23, 2:16 pm, Mark Murphy <[email protected]> wrote: > Stormtap Studios wrote: > > Thanks for the suggestion Mark, > > > I tried the following: > > > HttpClient httpclient = new DefaultHttpClient(); > > HttpGet httpget = new HttpGet(<my URL>); > > HttpResponse response = httpclient.execute(httpget); > > HttpEntity entity = response.getEntity(); > > if (entity != null) > > { > > InputStream stream = entity.getContent(); > > byte buf[] = new byte[1024 * 1024]; > > int numBytesRead; > > BufferedOutputStream fos = new BufferedOutputStream(new > > FileOutputStream(<my output file>)); > > do > > { > > numBytesRead = stream.read(buf); > > if (numBytesRead > 0) > > { > > fos.write(buf, 0, numBytesRead); > > } > > } while (numBytesRead > 0); > > fos.flush(); > > fos.close(); > > stream.close(); > > buf = null; > > httpclient.getConnectionManager().shutdown(); > > } > > > I timed it with GregorianCalendar objects instantiated before and > > after the process. It came in at 10.91 minutes (655 seconds). > > > I then tried the same code, but using a 1KB buffer instead of a 1MB > > buffer, this code came in at 713 seconds, 11.89 minutes. > > > I then timed my old code (in the first post) which clocked in at 15.43 > > minutes (925 seconds). > > > All of these times were running through the debugger on my dev phone > > 2. > > > Do you think I would get any speed improvement if I tried to figure > > out how to implement the BinaryResponseHandler? I found this > > HttpClient tutorial (http://hc.apache.org/httpcomponents-client/ > > tutorial/pdf/httpclient-tutorial.pdf) but I'm still not clear on how > > the response handler would fit my needs. From the example in the > > tutorial it seems like it returns a byte array, but that's not > > practical in my situation as the entity content would be ~6.5MB, > > better to write that to my file as I receive it. > > I just tried your code on a Nexus One, over WiFi, and it downloaded a > 5.9MB file in around 14 seconds. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > _The Busy Coder's Guide to *Advanced* Android Development_ > Version 1.3 Available! -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en To unsubscribe from this group, send email to android-beginners+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

