开发者

android: Detect if App was downloaded from market

开发者 https://www.devze.com 2023-01-19 09:59 出处:网络
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 f

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.


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

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


It seems that this can't be done.


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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号