如何运行外,下载Android上尚未安装的应用程序?应用程序、Android

2023-09-05 06:04:43 作者:深渊

我只是好奇:

有些应用程序,通常是开发商,允许其他下载示例应用程序并执行示例应用程序不进行安装。

Some apps , usually for developers, allow to download other sample apps and execute the sample apps without installing them.

有这样的应用程序的一个例子是酷DevAppsDirect"应用程序(强烈推荐BTW)。

An example for such an app is the cool "DevAppsDirect" app (highly recommend it BTW) .

我的问题是:

如何做这样的应用程序工作?

How do such apps work?

我的意思是,他们下载的APK?他们如何跳过安装阶段,并以某种方式运行下载的应用程序?难道他们不知何故与下载的内容合并?难道喜欢一个插件?

I mean , do they download the APK ? How do they skip the installation phase and somehow run the downloaded apps ? Do they somehow merge with the downloaded content? Is it like a plugin?

这样的事情能够为应用程序需要插件和扩展,也许其他的想法,我不能去想是有用的。

Such a thing could be useful for apps that require plugins and extensions, and maybe other ideas that I can't think about.

我也想知道怎么做的其他应用程序使用的插件机制。许多应用程序允许通过Play商店下载其他插件,应用程序。做他们以某种方式运行一些code。在其他的apk文件?可他们甚至到达其他的apk文件?有没有办法告诉机器人哪些应用程序可以访问我的APK文件?

i also wonder how do other apps use a plugins mechanism. many apps allow to download other plugins-apps via the play store. do they somehow run some code in the other apk files? can they even reach the other apk files ? is there a way to tell android which apps can access my apk file ?

推荐答案

您可以使用Android的类装载器(在这种特定情况下可能是PathClassLoader)动态加载类在运行时不进行安装。

You can use Android's class loaders (in this particular case probably the PathClassLoader) to dynamically load classes at runtime without installing them.

看看如https://github.com/Rookery/AndroidDynamicLoader看看这可怎么实现的。

Take a look at e.g. https://github.com/Rookery/AndroidDynamicLoader to see how this can be implemented.

插件的apk甚至都不需要的东西,复杂,但可以只​​通过发送到出口的活动意图沟通,调回结果。您可以使用PackageManager(http://developer.android.com/reference/android/content/pm/PackageManager.html)要查询哪些的Intent活动的登记。

Plugin apk's might not even need something that complicated but can just communicate via Intents sent to exported activities and posted back results. You can use PackageManager (http://developer.android.com/reference/android/content/pm/PackageManager.html) to query for which intents activities are registered.