简体   繁体   English

在拨打电话之前开始活动

[英]Starting an activity before phonecall is placed

I'm making an app where a BroadcastReceiver intercepts an outgoing call and starts an activity with an AlertDialog right before the phonecall is actually placed. 我正在制作一个应用,其中BroadcastReceiver截获去电并在实际拨打电话之前立即通过AlertDialog启动活动。 I've tested on several phones with different results. 我已经在几部手机上测试了不同的结果。 On two of the phones I've tested everything works great, the activity is started before the call is placed and therefore "interupts" the phonecall. 在我测试过的两部电话中,一切正常,在拨打电话之前开始活动,因此“中断”了电话。 After the activity is shut down, the phonecall resumes as normal. 活动关闭后,电话将正常恢复。

On the third phone, an HTC, this doesn't work. 在第三部手机(HTC)上,此功能无效。 The phonecall is placed before the activity starts. 电话会在活动开始之前发出。 How can I prevent this? 我该如何预防? Are there any priorities I should be looking for? 我应该寻找优先事项吗?

Welcome to the wide world of HTC headaches when it comes to android development, specifically regarding broadcast receivers. 当涉及到android开发时,尤其是广播接收器时,欢迎来到HTC的头疼世界。 Sense always seems to handle things differently, or in some special way. 感觉似乎总是以不同的方式或以某种特殊的方式处理事物。 Though this isn't really the best answer, it is too long for a comment. 尽管这并不是真正的最佳答案,但评论太久了。 After looking around a bit, this is a known issue with HTC. 环顾四周,这是HTC的一个已知问题。 A quick fix seemed to have been found at Problem with interecepting outgoing calls on HTC Desire , though somewhat outdated. 尽管问题已过时,但似乎在“ 问题”中发现了一种快速解决方案,可以拦截HTC Desire上的拨出电话

They state that you can try 他们说你可以尝试

As it seems the HTC Desire (2.2) responds to setResultData(null) which will stop the out dial. 看起来HTC Desire(2.2)响应setResultData(null) ,这将停止拨出。 Then you can place a new intent (Action.CALL) to call the new number. 然后,您可以放置​​一个新的意图(Action.CALL)来呼叫新号码。 Not so nice workaround, but as a user you hardly notice it. 并不是很好的解决方法,但是作为用户,您几乎没有注意到它。

Again I am not even sure if this works, or is the answer you are looking for, but it was too much for a comment :P 同样,我什至不确定这是否可行,或者您是否正在寻找答案,但是对于评论:P来说太过分了

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

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