简体   繁体   English

如何以忙音自动应答对Android设备的呼叫?

[英]How can I automatically answer a call to an Android device with a busy signal?

I'm developing a toy Android app: one of its functions is that it looks at incoming calls and if the calling number is in a blacklist, automatically closes the call. 我正在开发一个玩具Android应用程序:其功能之一是查看来电,并且如果来电号码在黑名单中,则会自动关闭该通话。 I'm having a problem making that work. 我在执行该工作时遇到了问题。 I'm referencing android.telephony.TelephonyManager to close the incoming call. 我正在引用android.telephony.TelephonyManager关闭来电。

Is there a way to let the caller think that I'm in another call (busy)? 有没有办法让呼叫者认为我在另一个呼叫中(忙)? Or to let the caller think that my phone is off or has no reception? 还是让呼叫者认为我的电话已关闭或没有接收?

use airplane mode 使用飞行模式

android.provider.Settings.System.putInt(mcontext.getContentResolver(), android.provider.Settings.System.AIRPLANE_MODE_ON, 1);
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); 
intent.putExtra("state", 1); 
mcontext.sendBroadcast(new Intent("android.intent.action.AIRPLANE_MODE")); 
mcontext.sendBroadcast(intent); 
try {
    Thread.sleep(500);
        }
    catch (InterruptedException e) {
        }
android.provider.Settings.System.putInt(mcontext.getContentResolver(), android.provider.Settings.System.AIRPLANE_MODE_ON, 0);
intent.putExtra("state", 0); 
mcontext.sendBroadcast(new Intent("android.intent.action.AIRPLANE_MODE")); 
mcontext.sendBroadcast(intent);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM