Q:

How does an Android device detect that an app has already been installed?

I would like to install multiple versions of the same app that I am developing on my phone. However, each time a different version of the app is installed on my device (even though they have different app_names), the previously installed on is deleted.
How does my device know that the new version and the old version of the app are the same?

A:

From http://developer.android.com/guide/topics/manifest/manifest-intro.html

The package name serves as a unique identifier for the application.

And later

The package name defines your application's identity, so if you change it, then it is considered to be a different application and users of the previous version cannot update to the new version.

