[英]Is it possible to access the camera of a handset from an application in android?
[英]Not Able to download .apk on Android handset from our site
当我开始从我们的网站上通过手机(Google Nexus)下载.apk时,发生以下情况:
1.我得到代码中的重定向链接2.开始下载应用程序,但是下载完成后,我得到错误下载未完成(失败)3.我得到错误页面,说该页面不可用,我可以上网
这是下载链接的格式:/game.do?x =&y =&z =
之前,我能够使用相同的代码下载应用程序。 。
如果您对问题有任何想法,请告诉我。
谢谢
Rakesh .apk大小从500KB到5MB不等
使用以下代码从服务器下载apk文件
private void download(){
try {
URL url = new URL("url from apk file is to be 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();
}
}
并参考以下链接以从URL下载并安装apk文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.