0
我做了這樣的代碼來回答編程:編程接聽電話
try {
telephonyService.answerRingingCall();
}
catch (Exception exx) {
answerPhoneHeadsethook();
}
private void answerPhoneHeadsethook() {
// Simulate a press of the headset button to pick up the call
Intent buttonDown = new Intent(Intent.ACTION_MEDIA_BUTTON);
buttonDown.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK));
activity.sendOrderedBroadcast(buttonDown, "android.permission.CALL_PRIVILEGED");
// froyo and beyond trigger on buttonUp instead of buttonDown
Intent buttonUp = new Intent(Intent.ACTION_MEDIA_BUTTON);
buttonUp.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_HEADSETHOOK));
activity.sendOrderedBroadcast(buttonUp, "android.permission.CALL_PRIVILEGED");
}
所以......我試着用接口ITelephony.aidl回答,如果它不能與Hadsethook使...它的工作幾乎所有類型的手機除了HTC Sensation(操作系統:Android 2.3.3)......任何人都可以幫助我解決這個問題!我會欣賞任何想法!謝謝! )
你有沒有解決這個問題?我是在浪費我的時間嗎? – user1163234 2012-03-08 18:06:11
它不能在HTC Desire Z,OS 2.3.3上工作......我很好奇這些設備是否有解決方法... – 2012-04-23 13:34:45