In your activity do
PackageManager pm = getPackageManager();
String installationSource = pm.getInstallerPackageName(getPackageName());
installationSource will now hold the package name of the app that installed your app.
testing with an app of mine installation source is "com.google.android.feedback" when installed via google market, null if installed via debugger.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…