0

I'm try to develop a application named General.apk which has 3 buttons(Let's name it A,B,C). I want to show these buttons every time and when i click on A button, it runs a.apk on half of the General.apk's screen. Is it possible? Any document or suggestion?

Sorry for bad language. Kind Regards

cantas
  • 104
  • 1
  • 14
  • 1
    it is possible. both need to have the same sharedUserId, and you need one of the apk to start the other one in a frame. I have worked on something like this but I don't remember how exactly it was done. – njzk2 Jan 22 '14 at 13:58
  • Can you suggestion any document or keyword for google search @njzk2 – cantas Jan 22 '14 at 14:01
  • This could help http://stackoverflow.com/a/21014339/671543 – njzk2 Jan 22 '14 at 14:04
  • fas as i remember, there was something to do with an ActivityGroup and the LocalActivityManager that can return you a Window object when you start an activity. The code of TabActivity could possibly help. – njzk2 Jan 22 '14 at 14:09
  • I will try to do that, i will inform you about that – cantas Jan 22 '14 at 19:01

1 Answers1

0

Is it possible?

Strictly speaking, it is not possible for any common definition of the phrase "runs a.apk". In particular, njzk2's comments do not "run" an APK.

There are techniques, such as the one that njzk2 linked to, for an Android app to execute Dalvik bytecode from another APK. However, this solution has many problems:

  1. Unless that bytecode was specifically designed to be used that way, the code from the other APK has no access to its own resources.

  2. The code from that other APK has no access to its own internal storage.

  3. The code from that other APK cannot use anything from its own manifest, such as permissions.

  4. Unless you take specific steps to attempt to validate the other APK, the other APK can have malicious code that you would wind up executing in your process, making you the potential means of delivering and deploying malware.

And those are just the problems from off the top of my head.

All of that can be overcome, by carefully crafting the code in the APK (and in your code that uses classes from that APK). So, for a plugin model, this approach is not out of the question, though it is complicated.

However, if you want to run some arbitrary APK, particularly one that you did not write yourself, the odds of it working successfully are very low.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I dont use any manifest or permission from a.apk. Think that, a.apk has one xml, and shows apple image. When i click the A button it shows a.apk in my general.apk You can think it as a iframe in html, you can show the a.com in the general.com – cantas Jan 22 '14 at 19:03
  • 1
    @user2922744: Again, Android does not really support this. If you wrote `a.apk`, there are approaches to make this possible, with the issues I cited in my answer. If you did not write `a.apk`, it is unlikely to work. – CommonsWare Jan 22 '14 at 19:08
  • I will inform you about that :) – cantas Jan 22 '14 at 19:28