---
title: "android autoanswer"
author: "kkcheng"
date: "2014-08-29T14:51:46Z"
tags: []
categories: ["移动开发"]
slug: "android-autoanswer"
draft: false
lastmod: "2014-08-29T14:52:18Z"
id: 2110755
url: "https://kkcheng.iteye.com/blog/2110755"
---

http://code.google.com/p/auto-answer/

Here is a code snippet to trigger an answer for the incoming call:

private void answerPhoneAidl(Context context) throws Exception {
// Set up communication with the telephony service (thanks to Tedd's Droid Tools!)
TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
ITelephony telephonyService;
telephonyService = (ITelephony)m.invoke(tm);
// Silence the ringer and answer the call!
telephonyService.silenceRinger();
telephonyService.answerRingingCall();
}


http://davidtpate.com/2014/02/23/auto-answering-calls-on-android/