编程方式查找是否来自未知来源的安装允许来源、方式

2023-09-04 05:27:01 作者:兮墨丶花易冷

我需要找到当前的Andr​​oid设备是否允许并非来自市场上的其它安装应用程序。此选项出现在设置界面下的一个名为未知来源应用程序。

I need to find whether the current Android device allows to install apps from sources other than the market. This option appears in the settings UI under Applications named "Unknown sources".

设置基本上可以让你下载和安装的APK这并没有从谷歌应用市场的起源。

The setting basically allows you to download and install APKs that did not originate from the Google app market.

如何查看该标志是否打开或关闭使用code?

How do I check whether this flag is on or off using code?

推荐答案

这个设置被称为INSTALL_NON_MARKET_APP" (点击查看文档)。

(我基本已经输入的问题时,我发现内心深处隐藏的文件,使用不同的名称的答案,所以我决定发布问题和自我回答,因为它是不平凡的。)

(I basically already typed the question when I found the answer hidden deep within documentation, with a different name, so I decided to post the question and self answer, since it's not trivial.)