简体   繁体   English

蓝牙HFP支持带有SIP / VoIP的Android应用程序

[英]Bluetooth HFP support for Android App with SIP/VoIP

I am trying to add support for bluetooth devices like headsets/headphones/car stereo to my android app which allows user to make SIP/VoIP calls. 我正在尝试添加对耳机/耳机/汽车音响等蓝牙设备的支持到我的Android应用程序,允许用户进行SIP / VoIP通话。 I am trying to mostly address the requirements of Answering and Ending of calls using button on bluetooth headsets, other buttons/features handling is good to have. 我试图主要解决使用蓝牙耳机上的按钮接听和结束通话的要求,其他按钮/功能处理是很好的。

With the search I have done and all the text I have read so far, I have come across the following- 通过我已经完成的搜索和我到目前为止阅读的所有文本,我遇到了以下情况 -

  • One common way suggested everywhere is registering to ACTION_AUDIO_STATE_CHANGED . 在任何地方建议的一种常见方式是注册到ACTION_AUDIO_STATE_CHANGED But this doesn't really helps me. 但这并没有真正帮助我。 Intents for it are sent every time the button on Bluetooth headset is pressed And also when we start the ring tone on bluetooth headset. 每次按下蓝牙耳机上的按钮时都会发送它的意图当我们在蓝牙耳机上启动铃声时也会发送它。
  • A very common solution I found was use of Bluetooth Adapter class. 我发现一个非常常见的解决方案是使用蓝牙适配器类。 There isn't much you could do with it. 你用它做的并不多。 So again not helpful. 所以再没有帮助。
  • Another approach I came across is the use of Vendor specific headset events. 我遇到的另一种方法是使用供应商特定的耳机事件。 After some efforts I was able to get this working for specific Plantronics Bluetooth headsets. 经过一番努力,我能够将其用于特定的Plantronics蓝牙耳机。 Supporting Jabra is important. 支持Jabra非常重要。
  • One more approach I came across is binding with IBluetoothHeadsetPhone.aidl, the way the phone app does it. 我遇到的另一种方法是绑定IBluetoothHeadsetPhone.aidl,这是手机应用程序的方式。 I could find very little information on it, not enough to go ahead and implement any thing. 我可以找到很少的信息,不足以继续执行任何事情。

If anyone has done such things, I think the problem I am facing is not an uncommon one, I just believe it is not documented well. 如果有人做过这样的事情,我认为我面临的问题不是一个不寻常的问题,我只是相信它没有记录好。 Any pointer, approach, link would be appreciated. 任何指针,方法,链接将不胜感激。

I will try to add more info as I find any or any other approaches I try. 我会尝试添加更多信息,因为我发现我尝试的任何或任何其他方法。 Please ask for details if you need any more on the solutions I have tried. 如果您对我尝试的解决方案有任何疑问,请询问详细信息。 And please suggest changes instead of just flagging the question. 请提出更改,而不是仅仅标记问题。 Thanks in adv. 谢谢你。

Sorry about the late post. 对于迟到的帖子感到抱歉。 I was able to find a solution for this issue. 我能够找到解决这个问题的方法。 It is not simple fix. 这不是简单的修复。

You need to use ConnectionService from Android telecom framework. 您需要使用Android电信框架中的ConnectionService。 Check out this link here & here . 在这里这里 查看此链接 After this your VoIP calls will have cellular call like treatment. 在此之后,您的VoIP呼叫将具有类似治疗的蜂窝呼叫。

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

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