Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
检测Android手机上的WiFi和其他设置_Android_Bluetooth_Settings_Global - Fatal编程技术网

检测Android手机上的WiFi和其他设置

检测Android手机上的WiFi和其他设置,android,bluetooth,settings,global,Android,Bluetooth,Settings,Global,我正在测试手机是否启用了蓝牙、WiFi、adb、密码和日志。我在使用getInt()方法时出错,我认为这与cr变量有关。我对这种类型的android编程相当陌生 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.l

我正在测试手机是否启用了蓝牙、WiFi、adb、密码和日志。我在使用
getInt()
方法时出错,我认为这与
cr
变量有关。我对这种类型的android编程相当陌生

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mListView = (ListView) findViewById(R.id.quotes_list);
    mListView.setAdapter(new QuoteAdapter(this));

    //determine if phone uses lock pattern
    ContentResolver cr = getBaseContext().getContentResolver();
    int lockPatternEnable;

    lockPatternEnable = Settings.Secure.getInt(cr, Settings.Secure.LOCK_PATTERN_ENABLED, 0);

    if (lockPatternEnable==0)
    {
        //lock pattern enabled
        lockPatternEnableBool = true;
    }
    if (lockPatternEnable==1)
    {
        //lock pattern disabled
        lockPatternEnableBool = false;
    }

    //determine if adb is enabled
    adb=Settings.Global.getInt(cr, Settings.Global.ADB_ENABLED, 0);


    //determine if bluetooth is enabled
    bluetooth=Settings.Global.getInt(cr, Settings.Global.BLUETOOTH_ON, 0);

    //determine if wifi is enabled
    wifi=Settings.Global.getInt(cr, Settings.Global.WIFI_ON, 0);

}// end of onCreate method