【发布时间】:2020-04-27 10:11:39
【问题描述】:
我正在构建 React Native 应用程序,我想检测用户是否打开了开发人员选项。 在 MainActivity.java 文件中,我总是遇到 SettingNotFoundException 异常。
import android.provider.Settings.Secure;
import android.provider.Settings.Global;
import android.provider.Settings.SettingNotFoundException;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
int devOptions = Secure.getInt(this.getContentResolver(), Global.DEVELOPMENT_SETTINGS_ENABLED);
}catch (SettingNotFoundException e){
Log.d(getClass().getName(), "Called");
}
}
【问题讨论】:
-
你read the doc了吗?
标签: android react-native-android