简体   繁体   English

创建后台 android 服务以拒绝来电

[英]create background android service to decline incoming phone calls

looking for resources on how to create an ongoing background service started by an android app which declines/silences and logs incoming phone calls.寻找有关如何创建由 android 应用程序启动的持续后台服务的资源,该应用程序拒绝/静音并记录来电。 This must not use deprecated APIs/permissions for Android 10.这不得对 Android 10 使用已弃用的 API/权限。

A way to decline an incoming call is to hang up the call but permissions are needed.拒绝来电的一种方法是挂断电话,但需要权限。 Try to follow this (this is the concept):尝试遵循这一点(这是概念):

  1. Request Run time permissions(READ_PHONE_STATE, CALL_PHONE)请求运行时权限(READ_PHONE_STATE、CALL_PHONE)

  2. Create a broadcast receiver that waits for incoming calls创建一个等待来电的广播接收器

  3. When incoming call is detected hang it up.当检测到来电时挂断。

Rely on this resource(here you have detailed instructions): https://dev.to/nikola/how-to-make-a-native-android-app-that-can-block-phone-calls--4e15依赖这个资源(这里有详细说明): https://dev.to/nikola/how-to-make-a-native-android-app-that-can-block-phone-calls--4e15

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM