简体   繁体   English

Android应用程序的软件包名称/域名重要吗?

[英]Is the package name / domain of my Android app important?

I created an Android app using a package name of (for example) com.myawesomeapp.android. 我使用(例如)com.myawesomeapp.android的程序包名称创建了一个Android应用程序。

I had purchased myawesomeapp.com, but I'm no longer interested in keeping the domain itself, but want to keep the app. 我已经购买了myawesomeapp.com,但不再对保留域名本身感兴趣,而是希望保留该应用程序。

Is there any danger in letting the domain expire? 让域过期有任何危险吗? If someone else later registers the domain, is there any way they could request control of the app from Google? 如果其他人以后注册了域,他们有什么方法可以要求Google对该应用程序进行控制?

Thanks! 谢谢!

Owning a domain name has nothing to do with it. 拥有域名与它无关。 You can choose any package name you want, for your app. 您可以为应用选择所需的任何包名称。 The combination of the app package name and your cert, are your app. 应用程序包名称和证书的组合就是您的应用程序。 Any bag of bits with that name and that cert are your app. 任何带有该名称和证书的位都是您的应用。

Same cert, different package name? 相同的证书,不同的软件包名称? Another app you created. 您创建的另一个应用。

Same package, different cert? 相同的包装,不同的证书? First install wins. 首次安装获胜。 If some user installs my app, with my cert and a given package name, and then tries tries to install your app, same package name, different cert, Android will refuse the second installation. 如果某些用户使用我的证书和给定的软件包名称安装了我的应用程序,然后尝试尝试以相同的软件包名称,不同的证书安装您的应用程序,Android将拒绝第二次安装。

It turns out that your app's package name becomes the name, essentially, of the user directory, on the device, which is the root for all of your application's persistent storage 事实证明,应用程序的程序包名称实际上就是设备上用户目录的名称,该目录是应用程序所有持久性存储的根目录

Btw, this has nothing at all to do with the java package you use for your application. 顺便说一句,这与您用于应用程序的java包完全无关。 Aapt, the resource compiler will uses the application package name as the java package for the java code it generates. Aapt,资源编译器将使用应用程序包名称作为其生成的Java代码的Java包。 If you happen to use the same package for your java code, then all the normal java rules apply: you don't have to explicitly import stuff that is in the same package. 如果碰巧对Java代码使用相同的程序包,则所有正常的Java规则都适用:您不必显式导入同一程序包中的内容。

Also, when specifying the names of java objects, in the Manifest, you can elide the name of the app package. 另外,在清单中指定Java对象的名称时,您可以省略应用程序包的名称。 Thus, eg, if your app package is foo.bar, and you have a class named foo.bar.baz.Zqx3, you need only enter ".baz.Zqx3" (actually, you can even leave off the initial '.'). 因此,例如,如果您的应用程序包是foo.bar,并且您有一个名为foo.bar.baz.Zqx3的类,则只需输入“ .baz.Zqx3”(实际上,您甚至可以省略首字母“。”。 )。

It is convenient to put your java in the same package as your app but it is absolutely not necessary. 将Java与应用程序放在同一软件包中很方便,但是绝对没有必要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM