如何以编程方式阻止呼叫机器人 [英] How to block a call programmatically in android
问题描述
可能重复:
如何阻止Android的电话
Possible Duplicate:
How to block calls in android
我正在开发的Android 2.2的一个应用程序获取手机状态和检查,如果来电号码在黑名单中的表比它要阻止特定number.for这个我用给定的code:
I am developing an app in Android 2.2 which gets the phone state and checks if the incoming number is in blacklist table than it has to block that particular number.for this i am using given code:
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
com.android.internal.telephony.ITelephony telephonyService = (com.android.internal.telephony.ITelephony) m.invoke(tm);
telephonyService.silenceRinger();
telephonyService.endCall();
一切都进展顺利,但有时我的手机响了第二次调用断开连接之前。
All is going well but sometime my phone rings for a second before disconnect that call.
请帮我,如果有任何其他方式做到这一点,或者我应该修改我的code静静地断开黑名单电话。
Please help me out if there is any other way to do this or should i modify my code to silently disconnect the blacklist call.
在此先感谢。
推荐答案
我觉得你必须提到这的问题。它可以帮助你做任何你想要的。
I think you must refer this question. It can helps you to do whatever you want.
这篇关于如何以编程方式阻止呼叫机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!