import com.iflytek.cloud.SpeechSynthesizer;
import com.iflytek.cloud.SynthesizerListener;
import com.iflytek.library.ApkInstaller;
import com.iflytek.library.TtsSettings;
/**
- Created by AlexZhou on 2015/4/21. 9:45
*/
public class SpeakService extends Service {
private static String TAG = SpeakService.class.getSimpleName();
private SpeechSynthesizer mTts; // 语音合成对象
private String voicer = “xiaoyan”; // 默认发音人
private String[] cloudVoicersEntries;
private String[] cloudVoicersValue;
private int mPercentForBuffering = 0; // 缓冲进度
private int mPercentForPlaying = 0; // 播放进度
private RadioGroup mRadioGroup; // 云端/本地单选按钮
private String mEngineType = SpeechConstant.TYPE_CLOUD; // 引擎类型
// 语音+安装助手类
ApkInstaller mInstaller;
private Toast mToast;
private SharedPreferences mSharedPreferences;
private String content = “你好”;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Bundle extras = intent.getExtras();
if (extras != null) {
content = extras.getString(“content”);
}
// 初始化合成对象
mTts = SpeechSynthesizer.createSynthesizer(this, mTtsInitListener);
mSharedPreferences = getSh