Not Able to download .apk on Android handset from our site -
when start downloading .apk on mobile handset(google nexus) our site,following thing happens:
1.i redirection link in code 2.start downloading application after download gets complete ,i error download not completed(failed) 3. error page, saying page not available,where able access net
here format of link down load:/game.do?x=&y=&z=
earlier able download applications same code. .
if have idea problem please let me know.
thanks
rakesh .apk size varies 500kb 5mb
use below code download apk file server
private void download(){ try { url url = new url("url apk file downloaded"); httpurlconnection urlconnection = (httpurlconnection) url.openconnection(); urlconnection.setrequestmethod("get"); urlconnection.setdooutput(true); urlconnection.connect(); file sdcard = environment.getexternalstoragedirectory(); file file = new file(sdcard, "filename.ext"); fileoutputstream fileoutput = new fileoutputstream(file); inputstream inputstream = urlconnection.getinputstream(); byte[] buffer = new byte[1024]; int bufferlength = 0; while ( (bufferlength = inputstream.read(buffer)) > 0 ) { fileoutput.write(buffer, 0, bufferlength); } fileoutput.close(); } catch (malformedurlexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } }
and refer below link download , install apk file url.
Comments
Post a Comment