An Android application (APK) may consist of more than one Activity, more than one Service. Each Activity or Service can run in its own process, can share a process or are run in the process of the calling Activity (and the calling Activity may not even be part of your application: e.g. the Contact app asking the Gallery app for a picture).
You can define your app's (APK's) manifest file to have certain activities/services run in their own processes or to just share the process of any calling activity. The process here is a process running on the Linux kernel. On Apr 10, 10:25 pm, Jason LeBlanc <[email protected]> wrote: > Since process != application.. just what are the distinctions? > > > > On Fri, Apr 9, 2010 at 5:06 PM, Bob Kerns <[email protected]> wrote: > > Just to point out a couple more things here. > > > 1) a Service's lifetime is NOT, in general, the same as an > > Application's lifetime. A service can be deleted when it's not in > > active use by any activity or intent. This can save memory. > > > 2) Under some circumstances, more than one application may be running > > in the same process. You won't be encountering those situations by > > accident, but it's an important part of the model nonetheless. In > > Android, process != application. > > > 3) By using a service, you get control over when and how your service > > gets restarted if your application and process get deleted in a low- > > memory situation. Services will be automatically restarted. > > Applications, and any singletons they manage, will not, unless they're > > required by a service being restarted! In a sense, your service > > continues to "exist" even when there's no process available to run it > > in.Once a process is available, your service is recreated and resumed. > > (This applies to services started with startService rather than > > binding. But if you want this, you can do both operations on the same > > service). > > > On Apr 9, 10:49 am, Mark Murphy <[email protected]> wrote: > > > ailinykh wrote: > > > > What do mean by "when all components of an Android application are > > > > destroyed"? > > > > Let's talk about Activity, for example. Does "destroy Activity" means > > > > unload Java class? > > > > No, I mean destroyed, as in onDestroy(). > > > > > If so, what happens when system tries to destroy activity but it is > > > > referenced by another object ( for instance, a singleton may keep > > > > reference to it) ? > > > > The component is destroyed from an Android standpoint, but the Activity > > > will not be garbage collected. This results in a memory leak and is why > > > mutable static data members should be avoided where possible. > > > > -- > > > Mark Murphy (a Commons Guy)http://commonsware.com| > >http://twitter.com/commonsguy > > > > Android App Developer Books:http://commonsware.com/books > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected]<android-developers%2bunsubs[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.

