如何阻止传出呼叫,安卓

2023-09-03 20:56:01 作者:有网友问小编,有没有一看就很厉害的,小编思考了一下,找了一些

我正在做一个应用程序,prevents呼叫某些联系人的用户。我在一个数据库中的联系人,但我不知道在哪里后去。我知道,我必须使用广播接收器,并允许在清单中,但比我卡等。

I'm working on making an app that prevents the user from calling certain contacts. I have the contacts in a database but I don't know where to go after that. I know that I must use a broadcast receiver and permission in the manifest but other than that I'm stuck.

推荐答案

这解释了如何做到这一点:http://groups.google.com/group/android-developers/browse_thread/thread/931e04811839326e

This explains how to do it: http://groups.google.com/group/android-developers/browse_thread/thread/931e04811839326e

的要点是,你需要使用 BroadcastReciever 拦截 NEW_OUTGOING_CALL 的意图,但要确保设定你的意图过滤器的优先级为-1。要中止呼出电话,你就需要调用 setResultData(空); BroadcastReceiver.onReceive(上下文,意图)返回前(其中prevents意图下游处理从处理呼出电话)。

The gist is that you need to use a BroadcastReciever to intercept the NEW_OUTGOING_CALL intent, but making sure to set the priority of your intent filter to -1. To abort the outbound call, you'll need to call setResultData(null); before returning from BroadcastReceiver.onReceive(Context, Intent) (which prevents downstream handlers of the intent from processing the outbound call).

相关推荐