1

I want to start a new activity in a separate android process by defining it as android:process=":processname" inside AndroidManifest.xml. However, I need to return a response to the caller activity. So, I need to start this activity through startActivityForResult(intent, requestCode) instead of startActivity(intent).

However, when I do not add intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), the new Activity won't start in a new process. When I add this flag, onActivityResult callback method of the caller Activity is not called. To sum up, my main aim is to separate activities within different processes so that the newly pushed activity should not decrease the performance (FPS value, for instance) of the caller Activity. Besides, the caller one should get a response from the newly pushed activity after it is destroyed which collides with the flag usage.

Ryan M
  • 18,333
  • 31
  • 67
  • 74
hanilozmen
  • 460
  • 4
  • 8
  • "So, I need to start this activity through startActivityForResult(intent, requestCode) instead of startActivity(intent)" -- there are other forms of IPC that you could use. "when I do not add intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), the new activity won't start in a new process" -- how have you determined this? "the newly pushed activity should not decrease the performance(fps value for instance) of the caller Activity" -- why do you think that a separate process will help? – CommonsWare Jun 26 '20 at 21:40
  • Actually, this is a problem which I faced with Cordova platform. For the first question, I tried it and measured the performance. My plugin uses Android webviews and Cordova's activity also uses webviews. They collides with each other when they are running in the same process. So, I need to start my plugin's activity in a new process to eliminate the performance problem. It is a must for me based on my hands on experience. – hanilozmen Jun 26 '20 at 21:45

0 Answers0