4

Is is possible to create a new APK by overloading/overriding and existing APK.

Say, we have WhatsApp messenger. Now if I want to show a notification like, "Person X is online now.", in notification area, it is not possible using the existing WhatsApp messenger. So, I'd like to develop a new custom messenger, which uses all the functionality of WhatsApp messenger, with some of my custom code. Just like importing JARs, can we import APK...??

This seems like using another persons work, but just from learning point of view, I'd like to know the possibilities. As of now, lets leave all the, security, vulnerability.

4

3 回答 3

6

In a nutshell, no.

APKs are not like Jar files such that you can simply import them into your app. They also contain other resources like the XML and assets. The code is kept in a classes.dex file, which is generated from the Jar file of the app code.

Moreover, each app runs in its own DVM, and is sandboxed to prevent this kind of interaction between apps. You cannot simply use WhatsApp's code in your own app as a third party apps.

There are however two ways to achieve what you want.

  1. If the app you are targeting provides an API by means of content providers, or even web services that you can use to access their data and events like users coming online. WhatsApp does not offer any such API
  2. You decompile the target app, and insert your own code to do what you want. This can be very hard because most popular apps, like WhatsApp, obfuscate their code making it hard to decipher (but not impossible). Additionally, WhatsApp encrypts most of its data like messages, contacts, chat threads etc using AES, which adds an additional layer to bypass in some places. Oh, and it also violates several IP and copyright laws if you do this.
于 2013-06-28T08:44:56.440 回答
2

是和否。

一个应用程序(一个独立的应用程序)可以通过多种方式与其他应用程序共享其信息。一种是通过使用内容提供者,另一种是通过自定义广播。

例如,如果 WhatsApp 已经记录了它的应用程序并且被构建以便您可以进一步构建它,您可以捕获这些广播并收听这些提供者,以便您的应用程序也可以对 WhatsApp 中所做的更改做出反应。

于 2013-06-24T07:11:48.330 回答
0

您可以创建一个 config.properties 文件并将其插入 wattsup messenger 的 Asset 文件夹中,假设您有源代码,

现在您必须配置您的自定义应用程序以在此文件中写入更改,但是您可以通过多种方式更改这些数据,例如允许您通过它们修改该文件中的数据的 web 服务。

好的,您可以进行更改,但您的应用程序将永远不会更新更改,因为您处理的是 APK 而不是代码,因此您必须再次重新生成 APK,以便它采用最新的更改。

对于自动 APK 生成,您可以使用 ANT 工具,通过在您的 wattsp 源代码中放置一个 build.xml 文件,您可以运行该脚本,该脚本将使用最新代码生成新的 APK,正如您所说,这些仍然是可能性,但在我的意见最后你不能将APK用作库

于 2013-07-02T13:14:42.120 回答