0

Might seem a pleonasm the 'Title' but I wrote it to emphasize the issue. I have an application running on an Android device, using the 2.2 Froyo library. The application has to (1) install - if not already installed - then (2) launch an .apk file already present in the data/data/myapp/files/ folder. Knowing Java I would have used a shell execution of the above operations. But Android is also a separate namespace, therefore I would like to know how to do the sequence install + launch of the .apk file. To note that, while I'm using Eclipse/Ubuntu now, the implementation should take into account ONLY the Android OS APIs, not my dev environment available tools. Thanks

Ginger Opariti
  • 1,282
  • 5
  • 23
  • 41
  • 1
    related: http://stackoverflow.com/questions/6813322/install-uninstall-apks-programmatically-packagemanager-vs-intents – zapl Aug 21 '12 at 12:06
  • @zapl: May thanks, that's what I was looking for. Since you put it as a comment I can't mark it as THE answer, but that's what it is! – Ginger Opariti Aug 21 '12 at 12:12
  • Just a link is not an answer, more a reason to close this question because it's a duplicate of the linked one :) – zapl Aug 21 '12 at 12:16

1 Answers1

1

You do not launch an apk file. An apk file can be thought of as a container holding some number of activities, services, receivers, among other constructs. It's likely you mean you want to launch an activity (which is performed using the startActivity() method from the Context class, or one of its many subclasses) but by no means is that a certainty.

It would seem from your question that you need to learn quite a bit about Android before continuing on the path suggested by your question, because the question you've posted is really too vague to be answered in a reasonable manner for stackoverflow.

mah
  • 39,056
  • 9
  • 76
  • 93
  • When people ask questions is because they are missing information. Anything can be learned if we'd have time. So 'learn quite a bit about Android ...' makes sense more or less, I take it positive anyway. It's true that my fingers typed too fast (I know what apk is), but, as I mentioned, I want to install first the application contained in the .apk file. That's the first question. Then, I want to launch THIS installed application, which - thanks! - can be performed through startActivity(). Following your help it remains just the first question ;-) ... – Ginger Opariti Aug 21 '12 at 12:00
  • I'm glad I was able to help in some manner. Please understand still though -- there is no such thing as launching an Android application either. Terminology may seem arbitrary however it's all we have to communicate with on a common ground, and when using the wrong terminology, communications (such as asking questions and receiving appropriate answers) suffers. I'm not trying to be nit-picky, I'm trying to help you. – mah Aug 21 '12 at 12:58