android检查是否允许以编程方式使用非市场应用程序

sbo*_*sbo 2 android google-play

如何以编程方式检查Android手机上是否允许非市场应用程序?

谢谢

Tal*_*lha 11

你可以尝试这个,它打开设置屏幕

检查一下

import android.provider.Settings;

int result = Settings.Secure.getInt(getContentResolver(),  Settings.Secure.INSTALL_NON_MARKET_APPS, 0); 
Run Code Online (Sandbox Code Playgroud)

打开设置

Intent intentSettings = new Intent();
 intentSettings.setAction(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
 startActivity(intentSettings);
Run Code Online (Sandbox Code Playgroud)