android震动效果实现,从Settings里面读值
震动效果实现如下:
[java] if(Settings.System.getInt(getContentResolver(), Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) != 0)
{
Vibrator vibrator = (Vibrator) getSystemService("vibrator");
vibrator.vibrate(50);
}
if(Settings.System.getInt(getContentResolver(), Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) != 0)
{
Vibrator vibrator = (Vibrator) getSystemService("vibrator");
vibrator.vibrate(50);
}
飞行模式判定:
[java] /**
* judge current airplane mode is set on
*
* @return
*/
private boolean isAirplanemodeOn()
{
return Settings.System.getInt(getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0;
}
摘自 知识空间
补充:移动开发 , Android ,