更新记录
1.0.6(2025-09-17)
增加短信拦截 支持返回接收短信的卡和卡号
如果需要读取短信内容 直接可用 如果需要拦截掉短信不被系统短信应用接收
那需要你的app设置为默认的短信应用,安卓4.4起已经做了限制 只有系统默认的应用才能
阻止系统应用接收信息 包括 信息、接打电话(不含来电拦截 来电拦截严格不是拦截 只是过滤和设置来电的显示形式)
// 启动短信拦截
startinterceptsms() {
onStartInterceptSMS(true, reslut => {
this.showresult = '接收信息的卡:>> : ' + reslut.receiverslot + ' 接收信息的号码'
+ reslut.receiverphonenumber + ' 发送人号码' + reslut.senderphonenumber + ' 发送时间' + reslut.sendtime +
' 发送的内容' + reslut.sendcontent
})
this.showresult = '短信拦截已启动'
},
// 停止短信拦截
stopinterceptsms() {
stopInterceptSMS()
this.showresult = '短信拦截已停止'
},
需要加入xml配置广播
<receiver android:name="uts.sdk.modules.xmtInterceptcall.ScreenReceiver" android:exported="true" android:enabled="true"
android:permission="android.permission.BROADCAST_SMS">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_DELIVER" />
</intent-filter>
</receiver>
1.0.5(2025-09-17)
增加短信拦截
1.0.4(2025-09-10)
增加去电拦截并返回呼出时所用的卡槽(卡1卡2)和呼出时使用的手机号 【来电拦截也支持卡槽和卡槽对应的手机号】 目前为全网第一份支持来去电显示卡槽和卡槽对应的手机号 注:9.14日会开放短信拦截 大概包含(发送人号码 接收短信的卡槽 接收短信的手机号 短信内容 发送短信时间(运营商处理短信的时间非uts接收的时间))
查看更多平台兼容性
uni-app x(4.76)
Chrome | Safari | Android | Android插件版本 | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|---|
× | × | 9.0 | 1.0.6 | × | - | - |
xmt-interceptcall
开发文档
来去电拦截支持情况
来电-来电号码【支持】
来电-来电呼入的哪个卡槽(卡1卡2)【支持】
来电-来电呼入的卡槽对应手机号【支持】
来电-白名单过滤(自行传入)【支持】
来电-国别、具体归属地(例:中国 山东/潍坊)【下版支持】
来电-运营商(例:移动、联通、电信、移动虚拟运营商、电信虚拟运营商等)【下版支持】
短信拦截支持情况(已开发完成正在整理代码 预计9月14日发布)
短信-发送者号码(谁给你发的短信)【下版支持】
短信-发送时间(运营商反馈的时间不是uts接收的时间)【下版支持】
短信-接收短信的卡槽(卡1卡2)【下版支持】
短信-接收短信的卡槽对应的手机号【下版支持】
<template>
<view style="flex: 1;padding-top: 55px;">
<text
style="line-height: 23px;width: 100%;text-align: center;font-size: 12px;color: darkred;lines: 5;">{{showresult}}</text>
<text class="linemodule" @click="getphonestatepermissions">获取网络状态权限</text>
<text class="linemodule" @click="getphonenumberpermissions">获取读取本机号码权限</text>
<text class="linemodule" @click="getSIMSlotCounts">判断手机卡槽</text>
<text class="linemodule" @click="readsimslotphonenumber">读取各卡槽手机号</text>
<text class="linemodule" @click="readdefaultslotphonenumber">获取默认卡槽及卡槽对应的手机号</text>
<text class="linemodule" @click="getcontacts">获取通讯录权限</text>
<text class="linemodule" @click="getcontactslist">读取通讯录联系人列表</text>
<text class="linemodule" @click="getsmspermissions">获取短信彩信读写权限</text>
<text class="linemodule" @click="readsmslist">读取短信列表</text>
<text class="linemodule" @click="gosendsms">静默发短信</text>
<text class="linemodule" @click="setdefaultinterceptapp">设置默认来电显示及拦截应用</text>
<text class="linemodule" @click="startintercept">启动电话拦截</text>
<text class="linemodule" @click="stopintercept">关闭电话拦截</text>
</view>
</template>
<script>
import {
onGetPhoneState,
onGetPhoneNumberPermissions,
getSIMSlotCount,
getSIMCardNumber,
getSIMCardDefaultNumber,
getSIMCardDefaultSlot,
onGetContactPermissions,
getContactsList,
onGetSMSPermissions,
setDefaultCallAndIntercept,
onStartInterceptCall,
stopInterceptCall,
readSMSList,
SendSMSOptions,
sendSMS
} from '@/uni_modules/xmt-interceptcall'
export default {
data() {
return {
title: 'Hello',
showresult: ''
}
},
onLoad() {
},
methods: {
// 获取网络状态权限
getphonestatepermissions() {
onGetPhoneState((permissionresult) => {
this.showresult = '网络状态获取结果>>' + permissionresult
})
},
// 获取手机号状态权限
getphonenumberpermissions() {
onGetPhoneNumberPermissions((permissionresult) => {
this.showresult = '读取本机号码>>' + permissionresult
})
},
// 获取卡槽数量
getSIMSlotCounts() {
this.showresult = '手机卡槽数量>>' + getSIMSlotCount()
},
// 根据卡槽读取卡槽中的手机号
readsimslotphonenumber() {
this.showresult = '卡1>>' + getSIMCardNumber(1) + ' 卡2>>' + getSIMCardNumber(2)
},
// 读取默认卡槽及卡槽手机号
readdefaultslotphonenumber() {
this.showresult = '默认卡槽>>' + getSIMCardDefaultSlot() + ' 默认卡槽手机号>>' + getSIMCardDefaultNumber()
},
// 获取通讯录读写权限
getcontacts() {
onGetContactPermissions((permissionresult) => {
this.showresult = '通讯录读写权限>>' + permissionresult
})
},
// 通讯录中的联系人列表
getcontactslist() {
this.showresult = '联系人列表>>' + getContactsList()
},
// 获取短信读写权限
getsmspermissions() {
onGetSMSPermissions((permissionresult) => {
this.showresult = '短信彩信读写权限>>' + permissionresult
})
},
// 设置默认来电显示及拦截应用
setdefaultinterceptapp() {
setDefaultCallAndIntercept()
},
// 启动来电拦截
startintercept() {
this.showresult = '来电拦截已启动>>'
onStartInterceptCall({
silentcall: true,
notallowsyscalllog: false,
stopcallwithoutnotice: false,
stopcallshownotice: false,
whitelist: []
}, reslut => {
this.showresult = '拦截来电:>> 来电卡槽' + reslut.callslot + ' 来电号码' + reslut.incallnumber + ' 来电时间' + reslut.incalltime
})
},
// 停止来电拦截
stopintercept() {
stopInterceptCall()
this.showresult = '来电拦截已停止>>'
},
// 短信列表读取
readsmslist() {
this.showresult = '短信列表>>' + readSMSList()
},
// 发送短信
gosendsms() {
sendSMS({
phonenumber: '',
sendnotes: '1'
} as SendSMSOptions)
}
}
}
</script>
<style>
.logo {
height: 100px;
width: 100px;
margin: 100px auto 25px auto;
}
.title {
font-size: 18px;
color: #8f8f94;
text-align: center;
}
.linemodule {
height: 39px;
line-height: 39px;
margin: 10px 10px 0px 10px;
border-radius: 3px;
background-color: #2180FE;
color: #ffffff;
text-align: center;
font-size: 12px;
}
</style>