java-更改拨出电话的号码,添加前缀

java-更改拨出电话的号码,添加前缀,第1张

概述根据Android开发人员博客上的此博客文章,应该可以更改拨出电话号码:http://android-developers.blogspot.com/2011/01/processing-ordered-broadcasts.html问题是它对我不起作用,我的代码:Stringaction=intent.getAction();if(Intent.ACTION_NEW_OUTGOING_CALL.equals(actio

根据Android开发人员博客上的此博客文章,应该可以更改拨出电话号码:
http://android-developers.blogspot.com/2011/01/processing-ordered-broadcasts.html

问题是它对我不起作用,我的代码:

@H_403_9@String action = intent.getAction();if (Intent.ACTION_NEW_OUTGOING_CALL.equals(action)) {    // Try to read the phone number from prevIoUs receivers.    String phonenumber = getResultData();    if (phonenumber == null) {        // We Could not find any prevIoUs data. Use the original        // phone        // number in this case.        phonenumber = intent                .getStringExtra(Intent.EXTRA_PHONE_NUMBER);    }        String reformatednumber = reformatNumber(phonenumber);    setResultData(reformatednumber);                                }

即使我重新格式化该号码,我拨打的电话号码仍在被呼叫.

有见识吗?

我的清单中有以下权限:

@H_403_9@<uses-permission androID:name="androID.permission.PROCESS_OUTGOING_CALLS" /><uses-permission androID:name="androID.permission.CALL_PHONE" /><uses-permission androID:name="androID.permission.CALL_PRIVILEGED" />

奇怪的是,当我打电话给我未存储在电话簿中的号码时,我有一项服务试图找出我正在打电话给谁,并且我必须在对话框中按“呼叫”按钮才能完成呼叫.然后,我的代码起作用了,但是当我从电话簿中呼叫某人时,或者如果我禁用了查找服务,它将无法正常工作.

解决方法:

您在博客文章中提到:

We have actually observed phones with
a priority 0 receiver for the
NEW_OUTGOING_CALL intent installed out
of the Box (this will be the last one
that is called after all others) that
completely ignores prevIoUs result
data which means that, in effect, they
disable any useful processing of
ACTION_NEW_OUTGOING_CALL (other than
canceling the call, which would still
work). The only workaround for this is
to also run your receiver at priority
0, which works due to particularitIEs
of running 2 receivers at the same
priority but, by doing that, you break
one of the few explicit rules for
processing outgoing calls:

“For consistency, any receiver whose
purpose is to prohibit phone calls
should have a priority of 0, to ensure
it will see the final phone number to
be dialed. Any receiver whose purpose
is to rewrite phone numbers to be
called should have a positive
priority. Negative prioritIEs are
reserved for the system for this
broadcast; using them may cause
problems.”

您是否有可能遇到这样的事实,即手机上的代码被提供商以优先级0安装的意图忽略了?您也可以通过将优先级设置为0来进行测试.

总结

以上是内存溢出为你收集整理的java-更改拨出电话的号码,添加前缀全部内容,希望文章能够帮你解决java-更改拨出电话的号码,添加前缀所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1071882.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存