我正在尝试停止铃声。当电话响起时,它会发出提示音。我试图根据某些因素来阻止这种声音,例如,黑名单上的来电者。
public class ReceiverClass extends BroadcastReceiver
{
@Override public void onReceive(Context context, Intent intent)
{
if ("android.intent.action.PHONE_STATE".equals(intent.getAction()))
{ String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
if (TelephonyManager.EXTRA_STATE_RINGING.equals(state))
{ String Caller = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
if(IsCallerInBlackList(Caller) == true)
----Stop the ringing here????---------
}
}
}
}