Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I was just wondering why the naming of some folders on android is such:

com.dropbox.android
com.android.browser
share|improve this question

2 Answers 2

Further to answer from @PratapPatil who has given the Android details.

This is a convention in programming, specifically here Java.

The Java Tutorials package details give details and examples.

With programmers worldwide writing classes and interfaces using the Java programming language, it is likely that many programmers will use the same name for different types. In fact, the previous example does just that: It defines a Rectangle class when there is already a Rectangle class in the java.awt package. Still, the compiler allows both classes to have the same name if they are in different packages. The fully qualified name of each Rectangle class includes the package name. That is, the fully qualified name of the Rectangle class in the graphics package is graphics.Rectangle, and the fully qualified name of the Rectangle class in the java.awt package is java.awt.Rectangle.

This works well unless two independent programmers use the same name for their packages. What prevents this problem? Convention.

Naming Conventions

Package names are written in all lower case to avoid conflict with the names of classes or interfaces.

Companies use their reversed Internet domain name to begin their package names—for example, com.example.mypackage for a package named mypackage created by a programmer at example.com.

Name collisions that occur within a single company need to be handled by convention within that company, perhaps by including the region or the project name after the company name (for example, com.example.region.mypackage).

For an alterative angle on this the StackOverflow quesion is around naming a hobby project. The nameing could be something like rossc.android.exampleproject since I don't have a domain of my own.

share|improve this answer

Every android app has access to a file space in the /data partition that is private to the app. This is where the sqlite databases and user settings (shared preferences) reside. Developer of the app does not have to worry about the naming convention or the location of the files they want to store as far as this private space is concerned.

However, when it comes to storing data in SD card (public space) by an app the app needs to make sure that the folder created by the app is unique and not used by any other app or by the device user. Android OS (AndroidManifest) identifies an app uniquely by their package name. Which you can even find the playstore urls. Example: https://play.google.com/store/apps/details?id=com.dropbox.android

Therefore, developers choose to use these package names to create folders to avoid conflict with other apps. This way does not guarantee that there will be no conflict but it prevent it to a large extent.

Another reason is this: when user moves the the application data to SD card the data from the application's private space is moved to the public space (SD card). This private space is named in the following way:-

Example: /data/data/com.dropbox.android. So this is moved to /sdcard/something/com.dropbox.android

share|improve this answer
    
Correction: If every app used its own name, it would prevent collisions, as two apps with the same name cannot be installed at once (they are, for Android, the same app). –  Darkhogg Jul 14 at 19:22
    
Even more precise: Always prevents collisions as long as both apps are from the Play store. If you had an app and downloaded one with the same package name from outside the play store, I think it'd replace the previous one on installation. Not sure what warnings the system might give. –  MPeti Jul 14 at 20:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.