Starting an Activity or Service with its own memory space
I have a memor开发者_StackOverflowy intensive process that needs to run and still allow the user to continue using the application. The application will throw out of memory errors if the user uses the app while this process is running. The following code launches an app from another app.
ntent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
startActivity(intent);
Is it possible to start an activity or service that lives inside an application as a new application or have it run outside the memory space of the currently running application?
I read about the android:launchMode attribute but it does not look like any of the attribute values will work.
I also read about creating a global service but the documentation does not state anything about where the service runs. Does a global service run in its own memory space or the memory of the application using it?
Any suggestions would be greatly appreciated.
Chris
I think I found the answer at http://developer.android.com/reference/android/app/Service.html
"If we want to make this service run in a remote process (instead of the standard one for its .apk), we can use android:process in its manifest tag to specify one:"
<service android:name=".app.MessengerService" android:process=":remote" />
"Note that the name "remote" chosen here is arbitrary, and you can use other names if you want additional processes. The ':' prefix appends the name to your package's standard process name."
I am assuming that the remote process means that it has its own memory space outside of the application. I will post update if it does not work.
精彩评论