开发者

Programmatically determine if application is the MarketPlace version

开发者 https://www.devze.com 2023-01-19 05:48 出处:网络
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 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 a开发者_如何学编程pplications" 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.


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


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.


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.

0

精彩评论

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