从自己的网络服务器下载APK [英] download apk from own Webserver

查看:239
本文介绍了从自己的网络服务器下载APK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我自己的Web服务器有问题,我下载的Andr​​oid应用程序。

I am having problem with download my android application from my own web server.

首先,我送一个HTML内容Java脚本要求Android手机来打开我的下载链接

First I sent a html content with java script to ask Android phone to open my download link

<html>
    <head>
        <script>
            window.onload=function()
            {{
                window.location = "downloadURL";
            }}
        </script>
    </head>
</html>"

Android手机revice这个Java脚本,将打开将downloadURL

Android phone revice this java script will open the downloadURL

在我的服务器端,我使用的.Net ASP

On my server end, I am using .Net ASP

我已经设置了MIME内容

I've set up the MIME content

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.android.package-archive";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + "MyApp.apk");
Response.AppendHeader("Content-Length", "" + response.Application.Bytes.Length);
Response.BinaryWrite(response.Application.Bytes);

APK文件是MyApp.apk大约是1.5MB

The apk file which is MyApp.apk is about 1.5MB

如何过,当我用Android模拟器下载的应用程序,文件大小只有4.25 KB,并且名称不MyApp.apk。它包含了我的下载链接的名称。

How ever, when I used Android emulator to download the app, the file size is only 4.25 KB, and the name is not MyApp.apk. It contains the name of my download link.

当我使用Firefox下载我的应用程序,Firefox的成功与正确的名称和大小下载。 请帮助我! 谢谢

When I use Firefox to download my app, Firefox successfully download it with correct name and size. Please help me out!! Thanks

当我调试我的服务器,我的服务器并发送出的应用程序字节,

When I debug my server, my server did sent out the application bytes with

Response.BinaryWrite(response.Application.Bytes);

我不明白为什么,Andorid的仿真器无法接收,这一翻译似乎创建HTML内容自身的apk文件。

I don't understand why, andorid emulator can not receive, intead it seems create its own apk file from the html content.

推荐答案

最后,我得到了我的问题解决了。

Finally I got my problem solved.

becase的火狐我下载链接发送一个HTTP请求的基础。

Becase Firefox sends one http request base on my download link.

但Android模拟器发送两个HTTP请求的基础上,我的下载链接

But Android emulator sends two http request base on my download link

我不得不忽视的第一个请求。

I have to ignore the first request.

我花了几个小时的数字出来。

It took me few hours to figure it out.

希望这些信息可以帮助别人

Hope this information can help others

这篇关于从自己的网络服务器下载APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆