如何在清单中分配 android:sharedUserId ?

发布于 2025-01-01 07:54:18 字数 319 浏览 6 评论 0原文

在 Android 中,您可以指定应用程序应在其下运行的 Linux 用户。在清单中,您只需将 android:sharedUserId 分配给所需的用户 ID。

问:您会建议该用户 ID 使用什么命名约定?为什么?

我可以想到这些可能的论点:

  1. 应该保证唯一性。
  2. 该名称应该能够被您发布的其他应用程序重复使用。
  3. 公司名称不应包含在内,因为它将来可能会发生变化。
  4. 该名称不应对项目中的“搜索和替换”操作敏感。

有想法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等数载,海棠开 2025-01-08 07:54:18

基本上建议使用包名称。这是因为包名也是唯一的,这是唯一重要的事情。
即使没有,使用相同 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文