if Android service is running in its own process say "STACKPR", and this Service will starts a new activity, Will this activity is part of "STACKPR" process by default or its part of application process ?
I tried the below method, but it is starting in a application process.
// in on start
Intent sIntent = new Intent(this, BasicActivity.class);
sIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(sIntent);
If it is not part of Service process, How to starts a activity which runs in that Service process ?
By default ALL application components (Activities, Services, etc.) run in a single process.
The Intent.FLAG_ACTIVITY_NEW_TASK
flag will create a new task stack for that Activity. Think of a new task stack as a separate entry when you press the Recents button. They are both in the same process though.
To have your Service, or any application component, run in a different process use android:process="<unique string>"
. However, this is NOT recommended and you can usually accomplish the same outcome using a threading model.
Please see here for more info: https://developer.android.com/guide/components/processes-and-threads.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.