android调用ITelephony类,AIDL实现电话,联系人黑名单拦截挂断服务

本文介绍了如何在Android中通过创建ITelephony.aidl文件,利用AIDL技术实现电话和联系人黑名单拦截挂断服务。详细步骤包括新建AIDL文件、布局文件、PhoneAction类的编写以及配置清单文件和所需权限。
摘要由CSDN通过智能技术生成

版权声明:本文为博主原创文章,未经博主允许不得转载。
首先新建AIDL文件,ITelephony.aidl。注意包名为com.android.internal.telephony,不可更改,此时需要重新rebuild project才能正常使用。

如图
总体效果图:如下

废话不多说,咱还是直接上代码吧:
首先布局文件:activity_phonestate

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_phonestate"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:orientation="vertical">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="黑名单"
            android:textColor="#0e0e0e"
            android:textSize="25dp" />
    </LinearLayout>




    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical">

        <EditText
            android:id="@+id/et_phone_et"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:ems="10"
            android:hint="请输入黑名单号码"
            android:inputType="phone">

            <requestFocus />
        </EditText>

        <Button
            android:id="@+id/bt_contact"
            android:layout_width="wrap_content"
            android:layout_height="40dp"
            and
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值