2011年4月25日 星期一

System Settings修改

System Settings修改
    // get screen off timeout time
    try {
        time = Settings.System.getInt(
            this.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT);
    } catch (SettingNotFoundException e) {
        e.printStackTrace();
    }
    // modify timeout time to 15 seconds
    Settings.System.putInt(
        this.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 15000);
    // modify rotation enable, 1: auto rotate on; 0: auto rotate off
    Settings.System.putInt(
        this.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1);
    // vibrator control
    vb = (Vibrator)getApplication().getSystemService(Service.VIBRATOR_SERVICE);
    vb.vibrate(1000*1000);    // parameter: vibrate time(ms)
    vb.cancel();    // stop

沒有留言:

張貼留言