Can multiple Android applications share a single process and application context?
android
Solution
Yes, they can. You just need to assign same values to `android:sharedUserId` and `android:process` in both applications and sign them with same certificate.
Related Links:
- `manifest` property `android:sharedUserId`
- `application` property: `android:process`
- Processes and Threads General Description
Problem
I am wondering if I could share a singleton on the application context across multiple applications? Each application would be in its own APK but This might sound like bad architecture but hear me out first. The reason I would like to do this is because I have an existing library which controls an external device over bluetooth. The library is java but under the covers there is allot of native (c/c++) all wrapped by java. I have looked at putting this all in a service but the IPC (I was using aidl) becomes very cumbersome fast. Trying to reduce object to primitives is next to impossible (private fields, jni pointers etc) and trying to wrap everything with AIDL is very messy. If each app could run in the same process and also have the same application context hence allowing me to keep a singleton object on there that would make things much easier. My googl-fu is failing me on this one. Maybe its not possible?