views:

69

answers:

3

I have an application that's offered in and outside of the MarketPlace.

Is there a way of determining from within the code where the application came from?

I've got a few indirect methods ...

1) I could simply infer from whether they have "Allow installation of non-Market applications" ticked ...

http://developer.android.com/reference/android/provider/Settings.html#ACTION_MANAGE_APPLICATIONS_SETTINGS

2) Or I could just make separate builds and make it explicit in the code.

A: 

Given that the Market application won't even know where an application came from when you wipe its cache, I very much doubt there is any other way to find out.

Habbie
A: 

Make it explicit in the android:versionName of each release.

And if the code is available for people to compile their own APKs, set the android:versionName to "custom" and just change it temporarily when building for the Market.

Nicolas Raoul
+1  A: 

If PackageManager.getInstallerPackageName() returns com.google.android.feedback for your application, then it was installed by the Android Market.

Christopher
Perfect, this sounds ideal.
jones77