Wednesday, February 26, 2014

Ask: Android in the Activity and Service are part of the same process


Hello everyone, I use the following method to get the process ID and thread ID:
 
int pid = android.os.Process.myPid ();
long tid = Thread.currentThread () getId ();.

Get to the process in Activity ID = 4285, thread ID = 1
In one bound to the Application of the Service to get the process ID = 4285, thread ID = 1
In a remote service to get the process ID = 4304, thread ID = 1

This is not a description of: Non-remote service, and Activity belong to the same processes and threads; while remote service and Activity were run in different processes?<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
A drop, as long as you do not open the thread, all the components (four components) are in the main thread to run, of course, under normal circumstances, only a process of a program, if the remote is inter-process communication, it is more than one process
Reply:
Yes, under the local service runs by default in the main thread of the current process, the remote service and then run another process.
Reply:
Understand. . . . . . . . . .

No comments:

Post a Comment