如何自动安装APK当文件下载完成(托管在私人) [英] How to install APK automatically when the file download is complete (hosted on private)

查看:223
本文介绍了如何自动安装APK当文件下载完成(托管在私人)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Andr​​oid和我一直在寻找的网站从最近​​两天这一点。我发现下面的链接太多,但我没有得到如何以及在哪里实现这个code后完全下载后,如何在安装后删除下载的APK文件开始自动安装apk文件中。请帮助我,指导我的正确途径。

如何安装apk文件编程

<一个href="http://stackoverflow.com/questions/2702178/invoking-activity-from-apk-in-another-android-application">Invoking在另一个Android应用程序从APK活动

的Andr​​oid APK安装编程

安装APK编程方式在Android

<一个href="http://www.anddev.org/viewtopic.php?p=23928">http://www.anddev.org/viewtopic.php?p=23928

编辑:

我写了这个code清单文件:

 &LT;使用-权限的Andr​​oid:名称=android.permission.INTERNET对/&GT;
    &LT;使用-权限的Andr​​oid:名称=android.permission.READ_PHONE_STATE/&GT;
    &LT;使用-权限的Andr​​oid:名称=android.permission.WRITE_CONTACTS/&GT;
    !&LT;  - &LT;使用-权限的Andr​​oid:名称=android.permission.INSTALL_PACKAGES/&GT; - &GT;
    &lt;应用机器人:图标=@可绘制/ biz_logo
        机器人:权限=android.permission.WRITE_CONTACTS&GT;
        &LT;活动机器人:名称=com.biz.mlm.Main&GT;
            &LT;意向滤光器&gt;
                &lt;作用机器人:名称=android.intent.action.VIEW/&GT;
                &LT;类机器人:名称=android.intent.category.DEFAULT/&GT;
                &lt;数据机器人:计划=内容/&GT;
                &lt;数据机器人:计划=文件/&GT;
                &lt;数据机器人:MIMETYPE =应用/ vnd.android.package存档/&GT;
            &所述; /意图滤光器&gt;
        &LT; /活性GT;
 

解决方案

不可能的。由于其中的一些环节指出,作出APK,可自动将自己安装和删除没有任何进一步的用户干预的原始安装程序被称为恶意软件。

您可以编写一个程序,将下载并安装任意的APK如果用户授予其相应的权限,但我还没有看到一个很好的实施或文件。通常情况下,你可以使用调用默认的系统安装code是这样的:

 文件apkFile =新的文件({路径APK});
    意向意图=新的意图(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(apkFile),应用程序/ vnd.android.package存档);
    startActivity(意向);
 

I am new to android and i have been searching the web from last two days for this. I found following links too but i am not getting how and where to implement this code to start automatic installation of the apk file after it downloads completely and how to delete the downloaded apk file after installation. Please help me by guiding me the right way.

how to install apk file programmatically

Invoking activity from APK in another android application

Android install apk programmatically

Install APK programmatically on android

http://www.anddev.org/viewtopic.php?p=23928

EDIT :

i have written this code in manifest file :

<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <!-- <uses-permission android:name="android.permission.INSTALL_PACKAGES"/> -->
    <application android:icon="@drawable/biz_logo"
        android:permission="android.permission.WRITE_CONTACTS">
        <activity android:name="com.biz.mlm.Main">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="content" />
                <data android:scheme="file" />
                <data android:mimeType="application/vnd.android.package-archive" />
            </intent-filter>
        </activity>

解决方案

Not possible. As some of those links point out, making an APK that automatically installs itself and deletes the original installer without any further user intervention is called malware.

You can write a program that will download and install arbitrary APKs if the user grants it the relevant permissions, but I'm yet to see a good implementation or documentation for this. Typically you can invoke the default system installer using code like this:

File apkFile = new File({path to APK});
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
    startActivity(intent);

这篇关于如何自动安装APK当文件下载完成(托管在私人)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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