Search code examples
androidnaming-conventionsmanifestuserid

How to assign android:sharedUserId in the manifest?


In Android, you can specify the Linux user under which your app should run. In the manifest you simply assign android:sharedUserId to the desired user ID.

Q: What naming convention would you recommend for this user ID? Why?

I can think of these possible arguments:

  1. Uniqueness should be guaranteed.
  2. The name should be able to be reused by other apps you release.
  3. The company name should not be included since it may change in the future.
  4. The name should not be sensitive to 'search and replace' actions in the project.

Ideas?


Solution

  • Basically its recommended to use the package name. This is, as the packagename also is unique and that is the only thing that basically matters. Even if not, two applications using the same id will only be runnable if they were certificated by the same certificate. Otherwise they will run completely separate. This is part of the android security model.