如何阻止呼出电话?

4
我正在使用以下代码来阻止呼入电话:

我正在使用以下代码来阻止呼入电话:

{
     telephonyService = (ITelephony) method.invoke(telephonyManager);
     telephonyService.silenceRinger();
     telephonyService.endCall();
} 

我想知道如何屏蔽外拨电话?


@Lucifer 我需要编程实现。 - Venkat
嗯,搜索激活Fixdialing的代码。 - Lucifer
嗨Venkat,请提供您的清单接收器代码。 - vipin
@vipin模拟器,我已经为呼入电话提供了ITelephony接口,所以我为呼出电话提供了ITelephony1接口。 - Venkat
Venkat,我认为同样的解决方案适用于两种情况,我已经找到了你问题的解决方法。 - vipin
显示剩余3条评论
1个回答

3
<receiver android:name="MyPhoneReceiver">
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.PHONE_STATE"></action>
                <action android:name="android.intent.action.NEW_OUTGOING_CALL"></action>
            </intent-filter>
        </receiver>

在你的广播接收器中。
@Override
    public void onReceive(Context context, Intent intent) {
      TelephonyManager telephony = (TelephonyManager)  context.getSystemService(Context.TELEPHONY_SERVICE);
CustomPhoneStateListener customPhoneListener = new CustomPhoneStateListener (context);
telephony.listen(customPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);
}

使用这个,你可以获取数字

如果想要阻止电话呼叫,请查看如何阻止电话呼叫和短信,并查看dharmendar的答案


我知道如何获取这个数字,但我不知道如何阻止它。 - Venkat
请检查我提供的链接以阻止该调用。 - vipin
他们只编写代码来查找外拨电话,我需要知道如何停止外拨电话。 - Venkat

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接