当TelephonyManager等于CALL_STATE_RINGING
时,如何在BroadcastReceiver中使用abortBroadcast()函数?
答案 0 :(得分:0)
让您的课程延长extends PhoneStateListener
覆盖onCallStageChanged()
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (state == TelephonyManager.CALL_STATE_RINGING) {
// phone is ringing, do your thing with abortBroadcast()
}
}
并按照您认为合适的方式实施中止
如果您获得BroadcastReceiver trying to return result during a non-ordered broadcast
,请移除对setResultCode();