采用aidl挂断电话
来源:互联网 发布:淘宝无法查询物流信息 编辑:程序博客网 时间:2024/06/11 20:58
aidl 工具类。
我们demo的结构。
布局文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".EndCallActivity" > <Button android:id="@+id/btn" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="end call" /></RelativeLayout>
activity代码
package org.china.lee.aidlendcalldemo;import java.lang.reflect.InvocationTargetException;import java.lang.reflect.Method;import com.android.internal.telephony.ITelephony;import android.app.Activity;import android.os.Bundle;import android.os.IBinder;import android.os.RemoteException;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;public class EndCallActivity extends Activity {private Button btn;private ITelephony iTelephony;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);super.setContentView(R.layout.activity_end_call);try {Method method=Class.forName("android.os.ServiceManager").getMethod("getService",String.class);IBinder bunder=(IBinder) method.invoke(null,new Object[]{TELEPHONY_SERVICE});iTelephony=ITelephony.Stub.asInterface(bunder);} catch (NoSuchMethodException e) {e.printStackTrace();} catch (ClassNotFoundException e) {e.printStackTrace();} catch (IllegalAccessException e) {e.printStackTrace();} catch (IllegalArgumentException e) {e.printStackTrace();} catch (InvocationTargetException e) {e.printStackTrace();}btn=(Button) super.findViewById(R.id.btn);btn.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {try {iTelephony.endCall();} catch (RemoteException e) {e.printStackTrace();}}});}@Overridepublic boolean onCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.end_call, menu);return true;}}
0 0
- 采用aidl挂断电话
- 采用aidl技术实现电话的挂断
- 使用AIDL挂断电话
- AIDL实现挂断电话
- AIDL自动挂断电话
- 通过aidl实现挂断电话
- Android黑名单电话挂断(AIDL)
- Android的AIDL以及挂断电话
- 通过AIDL实现挂断电话功能
- Android studio 挂断电话 使用ITelephony.aidl
- Android黑名单电话挂断(aidl)
- Android黑名单电话挂断(aidl)
- 通过AIDL及反射机制,使用隐藏API挂断电话
- 通过AIDL及反射机制,使用隐藏API挂断电话
- 通过AIDL及反射机制,使用隐藏API挂断电话
- 通过AIDL及反射机制,使用隐藏API挂断电话
- 挂断电话
- 挂断电话
- java二维码生成与解析代码实现
- iOS 在UILabel显示不同的字体和颜色
- 三重背包
- BOM之navigator对象
- 用Resteasy实现restful web service
- 采用aidl挂断电话
- 九度:1019<模拟>
- File类的部分常用方法
- C++函数重载详解
- 黑马程序员-第九天(包)
- Java中的Swing
- socket网络编程
- Scanner 与Console的用法和异同点
- 九度:1020<最小长方形>