动态更改来电铃声 [英] Dynamically change incoming call ringtone
本文介绍了动态更改来电铃声的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图动态地从文本合成语音代替我的手机铃声。但只要我得到一个来电我的应用程序看似松散的音频焦点,我不能动态地改变我的手机铃声。
I am trying to dynamically replace my ringtone with a synthesized speech from text. But as soon as I get an incoming call my app seems to loose audio focus and I cannot change my ringtone dynamically.
有没有办法做到这一点?
Is there a way to do this?
感谢
〜SAURABH
推荐答案
终于找到错误在我的code。
Finally found the bug in my code.
我在呼唤一个接收器为我的来电。我创建了 texttospeech
对象在我的的onReceive()
函数,而不是我的接收类构造函数。
I was calling a Receiver for my incoming calls. I was creating the texttospeech
object in my onReceive()
function instead of my Receive class constructor.
我不知道为什么,但是当我做出这个改变它的工作原理。
I don't know why but when I make this change it works.
这篇关于动态更改来电铃声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文