Android挂断、接听电话
来源:技术人生 责任编辑:栏目编辑 发表时间:2013-07-01 14:22 点击:次
一个很简陋的小例子
参考自:通过AIDL及反射机制,使用隐藏API挂断电话
个人理解上其实是同名类跨进程欺骗Dalvik VM,大伙儿可进一步联想扩展下功能,定会有惊喜!!!
以下为源码,仅做个人备份及参考。
package lab.sodino.phonecall; import android.app.Activity; import android.os.Bundle; public class PhoneCall extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
package lab.sodino.phonecall; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.telephony.TelephonyManager; import android.widget.Toast; /** *@author Sodino Email:sodinoopen@hotmail<br/> *@version 2011-2-6 下午10:38:55 */ public class PhoneListener extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); LogOut.out(this, "ord:" + isOrderedBroadcast() + " act:" + action); Toast toast = Toast.makeText(context, "", Toast.LENGTH_SHORT); if (action.equals("android.intent.action.NEW_OUTGOING_CALL")) { toast.setText("Outgoing"); } else { toast.setText("InComing"); TelephonyManager tm = (TelephonyManager) context .getSystemService(Service.TELEPHONY_SERVICE); boolean incomingFlag = false; String incoming_number = ""; switch (tm.getCallState()) { case Tele
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>