簡體   English   中英

如何以忙音自動應答對Android設備的呼叫?

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

我正在開發一個玩具Android應用程序:其功能之一是查看來電,並且如果來電號碼在黑名單中,則會自動關閉該通話。 我在執行該工作時遇到了問題。 我正在引用android.telephony.TelephonyManager關閉來電。

有沒有辦法讓呼叫者認為我在另一個呼叫中(忙)? 還是讓呼叫者認為我的電話已關閉或沒有接收?

使用飛行模式

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