有没有一种方法来检测,如果应用程序是用市场或没有安装? [英] Is there a way to detect if app was installed with Market or not?

查看:129
本文介绍了有没有一种方法来检测,如果应用程序是用市场或没有安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如果我能发现,如果我的应用程序与Android市场(它在市场的下载列表和资格更新检查)安装或它不是?

I am wondering if I am able to detect if my application was installed with Android Market (it's in the download list of the Market and eligible for update checks) or it's not?

这将是一个非常好的问题,以检测应用程序已不被安装,因为这可能意味着它被偷走,并安装了SD卡。

It would be a very good point to detect if the app has been installed without, as that can mean it was stolen and installed from SDcard.

推荐答案

在你的活动做


PackageManager pm = getPackageManager();
String installationSource = pm.getInstallerPackageName(getPackageName());

installationSource现在认为,安装在您的应用程序中的应用程序的包名。

installationSource will now hold the package name of the app that installed your app.

测试与煤矿安装源的应用程序是在通过谷歌电子市场安装com.google.android.feedback,NULL,如果通过调试安装。

testing with an app of mine installation source is "com.google.android.feedback" when installed via google market, null if installed via debugger.

这篇关于有没有一种方法来检测,如果应用程序是用市场或没有安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆