The package name

Any Android application (app) has a unique package name which identifies it on devices as well as on app markets such as Cafe Bazaar. In fact the package name is the identification tool for each app and is frequently called Application ID.

Caution: Once you publish your app in Cafe Bazaar under a certain package name, you won’t be able to change the name later on. If you do change the package name, it will be recognized as a new app on devices as well as on Cafe Bazaar and you won’t be able to upload it as an update of the original app.

Rules for naming packages

The rules for naming packages in Android are the same as those in Java programming. Generally speaking, the name of a package would better go as:

topleveldomain.companyname.applicationname

In fact, the first two segments of the application package name are your website address written in reverse order. For example, if your website address is www.example.ir and you intend to build a flashlight app, then:

topdomainname: ir

companyname: example

applicationname: flashlight

So, you would better name your application package as: ir.example.flashlight.

 

Allowed characters


Naming a package, you would be able to use the following characters:

  • Capital and small English letters (‘A’ to ‘Z’ and ‘a’ to ‘z’)

  • English numbers (‘0’ to ‘9’)

  • Underscore (‘_’)

Note: It is recommended that you not use capital letters in package names in order to avoid similarity to class names.

Special cases

  • In case your website address includes special characters such as dash (-) which you won’t be able to use in the package name, you are recommended to use underscore (‘_’) instead. For example, if the address is www.android-example.ir, you are recommended to use ir.android_example.flashlight as package name.

  • Your website address may contain some Java-reserved words, which you won’t be able to use as part of a package name. In that case, you are recommended to use underscore (‘_’) at one end of the word. For example, if your website address is www.example.int, since “int” is a Java-reserved word, you would preferably use int_.example.flashlight as package name.

Note: Also pay attention that the first letter of each segment of a package name (i.e. the letter that follows a dot) should be an English letter. Here you would not be able to use numbers or underscore. For example, ir.example.1flashlight or ir._example.flashlight cannot be accepted as package names.