전화를 받고 싶습니다. 나는 의도가 android.intent.action.ANSWER
인 것을 발견했다. 그러나 얻을 수있는 유일한 효과는 ActivityNotFoundException 인 것 같다. 왜? 그것은 비추천 의도입니까? 어떻게 대답을 얻을 수 있습니까? 텔넷 기술에 대해서도 들었습니다. 그게 뭐야? 그것은 불가능프로그래밍 방식으로 호출에 응답하는 방법?
감사
전화를 받고 싶습니다. 나는 의도가 android.intent.action.ANSWER
인 것을 발견했다. 그러나 얻을 수있는 유일한 효과는 ActivityNotFoundException 인 것 같다. 왜? 그것은 비추천 의도입니까? 어떻게 대답을 얻을 수 있습니까? 텔넷 기술에 대해서도 들었습니다. 그게 뭐야? 그것은 불가능프로그래밍 방식으로 호출에 응답하는 방법?
감사
은, 자세한 내용은 this 스레드를 확인합니다.
이 이벤트는 작동하지 않습니다. 당신은 사용해야 키를 눌러의 bhavior을 모방
Intent i = new Intent(Intent.ACTION_MEDIA_BUTTON);
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_HEADSETHOOK);
i.putExtra(Intent.EXTRA_KEY_EVENT, event);
context.sendOrderedBroadcast(i, null);
합니다.
답변의 의도는 InCallScreen에 보내야합니다.
adb shell am start -n com.android.phone/.InCallScreen -a android.intent.action.ANSWER
하지만 장치가
답을 뿌리 될 필요가 호출
try {
Thread.sleep(800);
Process process = Runtime.getRuntime().exec(new String[]{ "su","-c","input keyevent 5"});
process.waitFor();
}catch (Exception e) {
e.printStackTrace();
}
최종 통화 :
try {
Thread.sleep(800);
Process process = Runtime.getRuntime().exec(new String[]{ "su","-c","input keyevent 6"});
process.waitFor();
}catch (Exception e) {
e.printStackTrace();
}
아주 쉽고 간단한 해결책. 나를 위해 일했습니다. 많은 감사합니다! – Basher51
Android N에서 더 이상 가능하지 않습니다. https://source.android.com/security/bulletin/2016-03-01.html – AnixPasBesoin
날짜를 확인하십시오. 5 년 전 :-) – Seifolahi
접근 BT 핸드셋을 시뮬레이트하여 사용하면 모든 Android 버전 및 BT 핸드셋 처리와 같은 장치가 다를 수 있습니다.
장치와 안드로이드 버전 걸기의 압력과 통화 버튼의 출시 모방에있다, 많이 확인하는 가장 좋은 방법 :
Intent buttonDown = new Intent(Intent.ACTION_MEDIA_BUTTON);
buttonDown.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_CALL));
context.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_CALL));
context.sendOrderedBroadcast(buttonUp, "android.permission.CALL_PRIVILEGED");
당신은 할 수 있습니다 그 또한 셸 명령 "입력의 KeyEvent 5로 보내기 "를 통해 adb 또는 Runtime.exec 통해 내 경우에는 모든 장치에서 작동하지 않았다
이것은 안드로이드 2.2에서 4.0으로 작동하고 4.1.2 및 4.2 솔직히 작동하는 마지막 줄에 try catch를 추가 한 후 말하기는 어떻게 작동하는지 모르지만 그것은 나를 위해 일합니다.
Log.d(tag, "InSecond Method Ans Call");
// 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));
sendOrderedBroadcast(buttonUp, "android.permission.CALL_PRIVILEGED");
Intent headSetUnPluggedintent = new Intent(Intent.ACTION_HEADSET_PLUG);
headSetUnPluggedintent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
headSetUnPluggedintent.putExtra("state", 0);
headSetUnPluggedintent.putExtra("name", "Headset");
try {
sendOrderedBroadcast(headSetUnPluggedintent, null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
이
뿐만 아니라 전 4.2 에서 테스트 한 안드로이드 4.1.2에서 나를 위해 노력이 여전히 처리 예외를 제공합니다.try {
Runtime.getRuntime().exec("input keyevent"+Integer.toString(KeyEvent.KEYCODE_HEADSETHOOK));
} catch (IOException e) {
//handle error here
}
좋아, 스레드를 보았다 ...하지만 그 의도는 무엇입니까? 그리고 심지어 더 이상 사용되지 않습니다! – Matroska
ACTION_ANSWER에 대한 Google의 경우 통화에 자동 응답하는 방법을 찾기 위해 미친 사람들에 대한 다양한 주제를 찾을 수 있습니다. 이 기능은 안드로이드 스탭 (보안 이유?)에 의해 확실히 차단되었습니다. – systempuntoout