以编程方式确定应用程序是否为 MarketPlace 版本

发布于 2024-09-26 08:03:50 字数 412 浏览 0 评论 0原文

我有一个在 MarketPlace 内外提供的应用程序。

有没有办法从代码中确定应用程序来自哪里?

我有一些间接方法...

1)我可以简单地从它们是否勾选了“允许安装非市场应用程序”来推断...

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

2)或者我可以单独制作构建并在代码中明确它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

箜明 2024-10-03 08:03:50

如果 PackageManager.getInstallerPackageName () 为您的应用程序返回 com.google.android.feedback,然后该应用程序由 Android Market 安装。

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

时光瘦了 2024-10-03 08:03:50

在每个版本的 android:versionName 中明确说明。

如果代码可供人们编译自己的 APK,请将 android:versionName 设置为“自定义”,并在为市场构建时临时更改它。

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.

或十年 2024-10-03 08:03:50

鉴于当您擦除应用程序的缓存时,市场应用程序甚至不知道应用程序来自何处,我非常怀疑是否有任何其他方法可以找到答案。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文