Rectangle 27 0

Android application process?


By default, they will be in separate processes.

No. Installing an app does not fork a process for that app.

Whenever anyone creates android application which generates *.apk file and installed this apk on device, can we surely say that android has created new process for this apk ?

can we say that service accessing App and remote service both are different process ? I think Yes.

Note
Rectangle 27 0

Android application process?


I don't understand this question. You can package in an apk either a service or an application. And the service could also come with BroadcastReceivers and ContentProviders. And the application can come with multiple Activities, and also with BroadcastReceivers and ContentProviders. Al these are Android framework components, while a process is a running task. Activities are components that are displayed on screen, and usually a service has no need for such.

R1. The apk is just a package. When you start your application, low level, the linux machine on which Android is based will fork a process called Zygote. Then the copy of the Zygote (that already has either an instance of the Dalvik Machine mapped in its address space, or the ART libraries and Ahead Of Time compiled application code), will load all application specific java classes, and all core dependencies (native libraries), plus all application specific native code.

R2. If in the AndroidManifest you have a service declared as "exported", it will run in a separate process. Your application will then communicate with this process using an IPC mechanism called Binder, which is a specific implementation of shared memory at kernel level. AIDL is a meta-language interpreted at build time and used to auto-generate Java stubs that will work deep down with native binder code.

So it does create a new process only when you start the application.And hypothetically, you could create any number of processes for the same apk, which is just a container.

Whether apk contains any Activity or any Service which may be with BroadcastReceivers and ContentProviders. Once apk launch it is process right.

does it mean, each apk whether it is just service not activity or activity. it is separate process created internally.

Note