我编写了使用AlarmManager的应用程序,它的工作非常好但是当用户使用电话说话时,音乐在alarmManager中播放,因此对用户不利。
如何在电话繁忙时禁用AlarmManager
...谢谢
答案 0 :(得分:6)
TelephonyManager.getCallState()
告诉您,如果用户现在正在使用手机:
private boolean isUserInCall(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getCallState() != TelephonyManager.CALL_STATE_IDLE;
}