Opentalk(Vonage) API 设置 callertune 用于检测电话铃声
如何检测电话开始响铃拨出电话的时间。我正在开发一个应用程序,在该应用程序中我试图以编程方式拨打电话,并且当呼叫连接到互联网时,例如“什么应用程序音频呼叫应用程序”。我没有找到解决方案检测到接收方的呼叫正在响铃或忙。 我通过互联网使用令牌密钥和会话密钥连接我的呼叫。我的代码如下,用于传递调用活动的意图。
val intent = Intent(this@AstroDetailsActivity, CallActivity::class.java)
intent.putExtra(SESSION_ID_KEY, res!!.session_id)
intent.putExtra(TOKEN_KEY, res.token)
intent.putExtra("userId", MyApplication.sharedPreference?.userId.toString())
intent.putExtra("astroId", astroId)
intent.addCategory(Intent.ACTION_CALL)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
How to detect the time when a phone starts ringing for outgoing calls.I am developing an application in which i am trying to make a call programatically and when call is connected to internet like whats app audio call app.i didnt found the solution how to detect call is ringing or busy to reciever side.
i connect my call using token key and session key through internet. my code is below for passing intent to call activity.
val intent = Intent(this@AstroDetailsActivity, CallActivity::class.java)
intent.putExtra(SESSION_ID_KEY, res!!.session_id)
intent.putExtra(TOKEN_KEY, res.token)
intent.putExtra("userId", MyApplication.sharedPreference?.userId.toString())
intent.putExtra("astroId", astroId)
intent.addCategory(Intent.ACTION_CALL)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
示例代码 没有使用意图附加功能,所以我不确定您是否已对此代码进行了更改以实际初始化。
但如果您查看此 Activity,您将看到一个
PhoneStateListener
。该对象使用以下方式附加到呼叫:PhoneStateListener
然后有一个方法onCallStateChanged
,当电话呼叫的当前状态发生更改时,该方法将被调用。可以覆盖它以执行自定义逻辑,如下所示:The example code doesn't make use of intent extras so I am unsure if you have made changes to this code to actually initialise.
But if you look in this activity you will see a
PhoneStateListener
. This object is attached to a call using:The
PhoneStateListener
then has a methodonCallStateChanged
which gets called when the current state of a phone call is changed. This can be overidden to carry out custom logic as below: