Matt Robertson
Matt Robertson

Reputation: 3165

Does every Android process have its own thread?

Does every Android process by definition start its own thread? In particular, if I start a Service in a separate process within the same app by setting its android:process attribute in my manifest file, will it automatically run on a separate thread from the main thread of my app's default process?

I've read through the Processes and Threads Android documentation and this seems to be the implication, but it doesn't answer the question directly.

Upvotes: 1

Views: 421

Answers (1)

Zachary Sweigart
Zachary Sweigart

Reputation: 1111

Yes, since it is a different process, it will be a different thread.

android:process

The name of the process where the service is to run. Normally, all components of an application run in the default process created for the application. It has the same name as the application package. The element's process attribute can set a different default for all components. But component can override the default with its own process attribute, allowing you to spread your application across multiple processes.

https://developer.android.com/guide/topics/manifest/service-element

Thread run within a process

https://www.slashroot.in/difference-between-process-and-thread-linux

Upvotes: 3

Related Questions