|
|
@ -106,16 +106,13 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isScreenOn() {
|
|
|
|
private boolean isScreenOn() {//判断屏幕是否锁屏,调用系统函数判断,最后返回值是布尔类型
|
|
|
|
//判断屏幕是否锁屏,调用系统函数判断,最后返回值是布尔类型
|
|
|
|
|
|
|
|
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
|
|
|
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
|
|
|
return pm.isScreenOn();
|
|
|
|
return pm.isScreenOn();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void playAlarmSound() {
|
|
|
|
private void playAlarmSound() {//闹钟提示音激发
|
|
|
|
//闹钟提示音激发
|
|
|
|
Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM);//调用系统的铃声管理URI,得到闹钟提示音
|
|
|
|
Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM);
|
|
|
|
|
|
|
|
//调用系统的铃声管理URI,得到闹钟提示音
|
|
|
|
|
|
|
|
int silentModeStreams = Settings.System.getInt(getContentResolver(),
|
|
|
|
int silentModeStreams = Settings.System.getInt(getContentResolver(),
|
|
|
|
Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
|
|
|
|
Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
|
|
|
|
|
|
|
|
|
|
|
|