3

I have two applications, let's call them APP-A and APP-B, they share the userid "com.example.app.USER", if APP-A is running and I install APP-B, APP-A closes. Does anyone know if this behavior is intended? If it is, could you link to any reference in the documentation? If not, what can I do as a workaround?


EDIT:

Just a note: this happens when APP-B is installed via adb install, if installed from the device's file browser the proccess is killed then restarted. (This is very frustrating as this bypasses exception handling via try...catch blocks)

Saito Mea
  • 455
  • 4
  • 11
  • 1
    Why are you using `sharedUserId`? Why not use a cleaner API between the apps, secured by a signature-level custom permission? – CommonsWare Sep 14 '12 at 18:18
  • APP-B copies images over to the internal storage and shares their path with APP-A wich in turn can only access APP-B's sandbox if they share the same user id. Or am I mistaken? – Saito Mea Sep 14 '12 at 18:26
  • 3
    Have APP-B implement a `ContentProvider`. Have APP-A access the images via the `ContentProvider`. Use a signature-level custom permission to ensure that only APP-A (or any future app that you write) can use APP-B's `ContentProvider`. With this, you do not need to mess around with `sharedUserId`, and APP-A is not as dependent upon APP-B's implementation (e.g., APP-B can reorganize its directory structure but maintain a consistent `Uri` structure to insulate APP-A from those changes). – CommonsWare Sep 14 '12 at 18:53
  • Sadly I cannot alter the application in such way, I reconize it is a good solution however i must not discontinue the use of the `sharedUserId`. The behavior I cited is not nocive to the app but it is being considered a bug and I should provide information justify wether or not this is fixable. – Saito Mea Sep 14 '12 at 21:00
  • 1
    You can't stop Android from doing what it's doing during installation since that [is very central to the platform's security](https://github.com/android/platform_frameworks_base/blob/master/services/java/com/android/server/pm/PackageManagerService.java#L163). IDK if it is technically necessary to kill other apps of the same id but it's not unlikely that not doing so could result in errors and inconsistent states. – zapl Nov 26 '12 at 20:32

0 Answers0