Is there a way to detect if app was installed with Market or not?
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?
It would be a very good point to detect if 开发者_如何学Pythonthe app has been installed without, as that can mean it was stolen and installed from SDcard.
In your activity do
PackageManager pm = getPackageManager(); String installationSource = pm.getInstallerPackageName(getPackageName());
installationSource will now hold the package name of the app that installed your app.
testing with an app of mine installation source is "com.google.android.feedback" when installed via google market, null if installed via debugger.
If you're not root (and have access to Market database), I don't think it's possible.
精彩评论