android 出站来电显示 - 开/关

发布于 2024-09-24 19:00:02 字数 67 浏览 4 评论 0原文

我想以编程方式从我的活动中隐藏/显示我的来电显示。我试图在 android 文档中找到它,但没有成功。也许你有什么想法?

I wan to hide/show my caller id from my activity programmatically. I tried to find it in the android documentation but without the luck. Maybe you have any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

巷雨优美回忆 2024-10-01 19:00:02

我在 Android Google 群组上发布了一个问题,但完全没有得到任何答案。我还看到了其他几个关于 SO 的问题,这些问题也没有答案(或者没有答案)。

我得出的结论是,这根本不可能。我的理由是......

如果我进入“设置”->“致电-​​>其他设置,我看到一个 AlertDialog,其 HeaderTitle 为“呼叫设置”,并且我看到一个圆形进度指示器和一条消息,显示“正在读取设置...”。

我突然意识到我的手机正在访问我的手机/网络提供商。生成的“选择器”对话框为我提供了“网络默认”、“隐藏号码”和“显示号码”选项,当我做出选择时(或者即使我只是“取消”对话框),我会收到另一个带有循环进度的 AlertDialog带有消息“正在更新设置...”的指示器。

简而言之,来电显示设置似乎并不完全是手机设置的“本地”设置,而是依赖于与提供商的交互,并且无论出于何种原因,Android API 都不允许以编程方式对其进行操作。

我不确定这是否是 Android 未来版本的“待办事项”列表中的内容,或者允许这样做是否存在法律/安全问题或其他原因。无论情况如何,到目前为止,我还没有找到任何人能够解释为什么 TelephonyManager(例如)没有一种方法来简单地切换它。

编辑: 使用标准 API 获取附加设置 AlertDialog 也没有运气。

我这样说的原因是,可以调出设备“设置”的各个部分,例如,在我的一个应用程序中,我在传递给 startActivity() 的 Intent 构造函数中使用 android.provider.Settings.ACTION_WIRELESS_SETTINGS 。这将打开“设置”页面,用于启用/禁用 Wi-Fi、移动互联网和蓝牙。

android.provider.Settings 对于其他设置页面有其他类似的操作,但甚至没有一个用于“呼叫”的操作,更不用说呼叫 ->警报对话框的其他设置和任何内容都不允许您选择隐藏/显示拨出呼叫者 ID。

如果可以做到这一点,那么它一定是一个未记录的 API,除非我完全错过了它(我花了很长时间寻找)。我怀疑检查 Android 源代码可能是找到答案的唯一方法,但我还没有尝试过。

I posted a question asking this on the Android Google group and got absolutely no answers at all. I've also seen a couple of other question on SO which also had no answers (or none that work).

I came to the conclusion that it simply isn't possible. My reasoning is this...

If I go to Settings -> Call -> Additional settings, I see an AlertDialog which has a HeaderTitle of 'Call settings' and I see a circular progress indicator and a message saying 'Reading settings...'.

It occurs to me that my phone is, at that point, accessing my phone/network provider. The resulting 'chooser' dialog gives me options for 'Network default', 'Hide number' and 'Show number' and when I make a selection (or even if I just 'Cancel' the dialog), I get another AlertDialog with circular progress indicator with the message 'Updating settings...'.

In short, it seems the Caller ID setting is not entirely 'local' to the phone settings and relies on interaction with the provider and, for whatever reason, as a result of this the Android APIs don't allow this to be manipulated programatically.

I'm not sure if this is something on the 'To Do' list for future versions of Android or if there are legal/security implications in allowing it to be done or some other reason. Whatever the case may be, I haven't found anybody so far who is able to explain why there isn't a method for TelephonyManager (for example) to simply switch this.

EDIT: No luck on getting the Additional Settings AlertDialog with the standard APIs either.

The reason I say that is that it is possible to pull up various parts of the device's 'Settings', e.g., in one of my apps I use android.provider.Settings.ACTION_WIRELESS_SETTINGS in the constructor of an Intent passed to startActivity(). This brings up the Settings page for enabling/disabling wi-fi, mobile internet and bluetooth.

android.provider.Settings has other similar ACTIONs for other Settings pages but there isn't even one for 'Call' never mind Call -> Additional Settings and nothing for the AlertDialog to allow you to choose to Hide/Show the outgoing Caller ID.

If this can be done then it would have to be an undocumented API unless I completely missed it (I spent a long time looking). I suspect examining the Android source-code may be the only way to find an answer and I haven't attempted that yet.

触ぅ动初心 2024-10-01 19:00:02

我已成功获得“附加呼叫设置”对话框。解释如下:

虽然看起来它是Settings的一部分,但实际上它是Native PhoneApp的一部分。如果您查看 PhoneApp 的 AndroidManifest.xml,您将看到 Activity GsmUmtsAdditionalCallOptions 已为 android.intent.action.MAIN 定义了 IntentFilter。

因此,我检查的代码在多部手机上都能正常工作:

Intent additionalCallSettingsIntent = new Intent("android.intent.action.MAIN");
ComponentName distantActivity = new ComponentName("com.android.phone", "com.android.phone.GsmUmtsAdditionalCallOptions");
additionalCallSettingsIntent.setComponent(distantActivity);
startActivity(additionalCallSettingsIntent);

I have managed to get Additional call settings dialog. Explanation below:

Although it looks like it is part of the Settings, in fact it is part of the Native PhoneApp. If you take a look at the AndroidManifest.xml of the PhoneApp you will see that Activity GsmUmtsAdditionalCallOptions has defined IntentFilter for the android.intent.action.MAIN.

So, the code that I checked to work correctly on several phones:

Intent additionalCallSettingsIntent = new Intent("android.intent.action.MAIN");
ComponentName distantActivity = new ComponentName("com.android.phone", "com.android.phone.GsmUmtsAdditionalCallOptions");
additionalCallSettingsIntent.setComponent(distantActivity);
startActivity(additionalCallSettingsIntent);
绅士风度i 2024-10-01 19:00:02

如果 #31# 技巧满足您对单次呼叫的需求,那么您可以添加一个广播接收器,用于侦听拨出呼叫通知并修改号码以在拨打之前在开头包含 #31#。 Android 允许在传输过程中更改号码。

仅当您的默认设置是启用来电显示并且您的网络支持 #31# 并且您想使用小部件将其关闭时才有效。

If the #31# trick works for your needs for a single call then you could add a broadcast receiver that listens for the outgoing call notification and modifies the number to include #31# at the start before it gets dialled. Android allows the number to be changed on the way through like that.

Only works if your default is to enable caller ID and your network support #31# and you want to toggle it off using a widget, say.

三生路 2024-10-01 19:00:02

来电显示是特定于网络的,不是电话控制的。事实上,在某些移动网络配置中,手机甚至不“知道”自己的电话号码。

某些网络支持发送激活/停用呼叫者 ID 网络命令。在 GSM 中,这通常是#31#。它可以是永久性的,也可以根据每次调用而定。

  1. 永久请求网络隐藏所有呼叫的呼叫者 ID。
  2. 每次呼叫请求网络仅隐藏该呼叫的呼叫者 ID。后者是通过在呼叫号码前添加 #31# 来实现的,因此例如呼叫 #31#85432786426 将呼叫 85432786426,隐藏呼叫者。

有些网络同时支持两者,有些网络仅支持其中之一,有些则不启用。试试你的运气,尝试在拨打的号码前加上#31#,看看是否有效。

http://www.gsm-security.net/faq /gsm-caller-id-clip-clir.shtml

The Caller ID is network specific not something that the phone controls. In fact in certain mobile network configurations the phone doesn't even 'know' its own phone number.

Some networks support sending an activate/deactivate caller ID network command. In GSM this is normally #31#. It can be permanent or on a per call basis.

  1. Permanent requests the network to hide the caller ID for all calls.
  2. Per call requests the network to hide the caller ID only for that call. The latter is achieved by prefixing the number being called by #31#, so for example calling #31#85432786426 would call 85432786426 hiding the caller.

Some networks support both, some only support one of them, and some do not enable it. Try your luck and try prefixing the dialed number with #31# and see if it works.

http://www.gsm-security.net/faq/gsm-caller-id-clip-clir.shtml

攀登最高峰 2024-10-01 19:00:02

如果您想要其他通话设置的快捷方式,可以使用 App Cut 并选择 GSM 设置。它将在您的主屏幕上放置一个快捷方式。

If you want a shortcut to the additional call settings, you can use App Cut and select GSM settings. It will place a shortcut on your home screen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文