如何在清单中分配 android:sharedUserId ?
在 Android 中,您可以指定应用程序应在其下运行的 Linux 用户。在清单中,您只需将 android:sharedUserId
分配给所需的用户 ID。
问:您会建议该用户 ID 使用什么命名约定?为什么?
我可以想到这些可能的论点:
- 应该保证唯一性。
- 该名称应该能够被您发布的其他应用程序重复使用。
- 公司名称不应包含在内,因为它将来可能会发生变化。
- 该名称不应对项目中的“搜索和替换”操作敏感。
有想法吗?
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:
- Uniqueness should be guaranteed.
- The name should be able to be reused by other apps you release.
- The company name should not be included since it may change in the future.
- The name should not be sensitive to 'search and replace' actions in the project.
Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上建议使用包名称。这是因为包名也是唯一的,这是唯一重要的事情。
即使没有,使用相同 id 的两个应用程序也只有在通过相同证书进行认证的情况下才能运行。否则它们将完全分开运行。这是 Android 安全模型的一部分。
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.