android: Detect if App was downloaded from market
Asked Answered
K

5

7

I've got an app which I would like to distribute through the market place and also from my own site. How do I, using only one build and one key, check to see if the app was downloaded from the market place or not?

This question is answered by having the code signed with different keys, but we ideally want a single build.

Ketty answered 8/10, 2010 at 11:30 Comment(2)
As far as I know this couldn't be done in one build.Intoxicated
Sergey - Stick this down as an answer and I'll mark it as correct. From what I can tell, you're right in that this is not possible.Ketty
K
2

It seems that this can't be done.

Ketty answered 19/10, 2010 at 16:38 Comment(1)
Note that it only can't be done given the OP's constraints. It could done by signing the Market build with a unique key, and comparing a checksum of the key against a stored value inside the app. Personally, I prefer to customize by build script for release vs. debug builds.Lemming
E
4

packageManager.getInstallerPackageName(context).equals("com.google.android.feedback")

http://developer.android.com/reference/android/content/pm/PackageManager.html#getInstallerPackageName(java.lang.String)

Emersion answered 21/10, 2011 at 18:2 Comment(1)
This might not be a viable solution, as some developers are reporting that getInstallerPackageName() does not always return the same value (or any value at all) when the application is installed via the Market.Lemming
K
2

It seems that this can't be done.

Ketty answered 19/10, 2010 at 16:38 Comment(1)
Note that it only can't be done given the OP's constraints. It could done by signing the Market build with a unique key, and comparing a checksum of the key against a stored value inside the app. Personally, I prefer to customize by build script for release vs. debug builds.Lemming
J
1

On my Android 1.5 handset only applications installed via Market are listed in "My downloads" in Market App, so the question is if you can retrieve that list in runtime. I don't know if it's the same with Android 2.x.

Jackstraws answered 8/10, 2010 at 17:30 Comment(0)
H
1

Paid apps from the market can use the Android Licensing Module to determine if they are buyed from the market. But for free apps i don't know a solution

http://developer.android.com/guide/publishing/licensing.html

Holifield answered 23/12, 2010 at 11:4 Comment(0)
P
0

I don't know if this really correlates or not, but if you can read /data/system/packages.xml market apps seem to have installer="com.google.android.feedback" while those bundled with the system build and those locally compiled do not.

Pilsen answered 8/10, 2010 at 15:50 Comment(1)
Recently Android Market has package "com.android.vending".Mal

© 2022 - 2024 — McMap. All rights reserved.