在Android 2.1中自动接听电话 [英] Automatically answer call in android 2.1

查看:92
本文介绍了在Android 2.1中自动接听电话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一些代码来自动应答android 2.1中的来电。我已经研究了堆栈溢出中的一些可用线程,但它们似乎不适用于Android 2.1。

I am looking for some code to automatically answer incoming call in android 2.1. I have looked on some of the available threads on stack-overflow but they do not seem to work for Android 2.1.

任何人都可以给我一些代码来帮助我。

Can anybody give some peace of code to help me. Thanks in advance.

推荐答案

//设置与电话服务的通信(感谢Tedd的Droid Tools!)

// 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();

请参考 LINK1 LINK2

这篇关于在Android 2.1中自动接听电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆