I'm using AIDL service in my app.
I also want to run it another process, so I use android:process=":remote"
in service declaration in the manifest.
My problem is that when the :remote
process starts it apparently recreates Application
object.
I really do not with that as I override application object and call lots of client stuff in the onCreate()
method. Yet I want the service code to reside in the same apk with the client.
Can I achieve that? Is Application
object always recreated when new process starts?
Appreciate your help. Thanks!
As already mentioned by CommonsWare, each of the processes gets its own
Application
object.In your
Application.onCreate()
method you can check whether the method is being called from within the main process or from within the remote process and initialize different stuff accordingly.Why? What value does that add to the user, to offset the additional RAM, CPU, and battery cost? Very few apps need more than one process.
Of course. Each process gets its own.
Then get rid of
android:process=":remote"
. Your users will thank you.What service?
Yes.