阻止来电,即使只有不到一秒的时间 android
我使用了以下代码:
问题:它工作正常并阻止来电,但电话在断开呼叫之前响了几分之一秒。有没有我正在寻找的解决方案。
public class CallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras();
incomingNumber1 = b.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
TelephonyManager telephony = (TelephonyManager)context
.getSystemService(Context.TELEPHONY_SERVICE);
Class c = Class.forName(telephony.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
telephonyService = (ITelephony) m.invoke(telephony);
telephonyService.endCall();
}}
我还没有找到问题的答案。我想要在 Android 2.3 上完美运行的解决方案。来电要完全屏蔽,不得有响铃。
i have used the following code:
Problem: It is working fine and blocking incoming call but phone ring for fraction of a second before disconnect the call. can there be a solution which i am looking for .
public class CallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras();
incomingNumber1 = b.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
TelephonyManager telephony = (TelephonyManager)context
.getSystemService(Context.TELEPHONY_SERVICE);
Class c = Class.forName(telephony.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
telephonyService = (ITelephony) m.invoke(telephony);
telephonyService.endCall();
}}
I have not found the answer to the problem yet. I want solution which work perfectly on Android 2.3. Incoming call is to be blocked fully there must not any ring.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论